How does the CALCULATE function (DAX) work?
The CALCULATE function (DAX) is one of the most important and most used functions in Power BI.
It changes the context in which data is being filtered, and evaluates the expression using the new context.
It also removes any existing filters on a column, and makes use of the filter used in the filter argument.
CALCULATE Formula Syntax
How do you use the CALCULATE function?
The CALCULATE function is such a useful tool because it changes the filter context and simplifies complex calculations with little effort, especially when used with statistical or time intelligence functions.
This function is so versatile that it is used to produce the desired outcome from simple filters to the more advanced formulas.
Related Blog Posts
Considerations when using the CALCULATE function
Filters created using the CALCULATE function will override any filters created on the canvas.
When a filter argument has the form of a predicate with a single column reference, the expression is embedded into a FILTER expression that filters all the values of the referenced column.
Related Video Tutorials
Formula examples using the CALCULATE function
=( SUM(‘ResellerSales_USD'[SalesAmount_USD])) /CALCULATE( SUM(‘ResellerSales_USD'[SalesAmount_USD]) ,ALL(‘ResellerSales_USD’))
CALCULATE(AVERAGE(Website[Sessions]),Website[type]=”Organic Search”, Website[gender]=’female’)