How to use Calculate function in Power BI
--
Calculate function is the most powerful function in Power BI. If used strategically it can produce wonderful insights.
What is Calculate function?
Microsoft defines calculate function as “Evaluates an expression in a context modified by filters.”
Too complex to understand. Let me simplify it:-
The expression for Calculate function: Basically calculate function has two parts
a. Expression: What we are trying to calculate
b. Filters:- What condition we are trying to implement while evaluating the expression
How to use Calculate function: Assume we are having the sales value of four regions as per below table
Now the garment merchant wants to see the total sales in the next columns of sales. We can easily achieve this by applying the below Calculate function
- Expression:- Sum of Sales from the fact table
- Filter:- We want all sales for all-region from the state table
Now let's enjoy the power of DAX
Now the garment merchant wants to see the percentage of sales for each region. We can easily achieve it by using DAX. Here we will be using Total Sales that is already created
Want to see more power of Calculate functions please comment I will add give more example of Calculate function