CALCULATE Function (DAX)

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

CALCULATE(
     <expression>,<filter1>,<filter2>…
)

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

ACOSH Function (DAX)

Related Support Forum Posts

FILTER function inside CALCULATE
How to utilise a Boolean expression within the CALCULATE function
Calculate function in a measure breaks cross-table filtering?

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’)

CALCULATE(SUM(Website[Sessions],YEAR(Website[date)-1)

Related DAX Functions

Related Course Modules

Ultimate-Beginners-Guide-To-PowerBI
Center of Excellence

DOWNLOAD


Download our comprehensive DAX Formula Reference Guide as perfect companion as you learn how to use DAX formulas within Power BI.


Download DAX Formulas Reference Guide
Download DAX Formula Reference Guide
Membership