DAX Function Guide

CALCULATE
Empty image or helper icon

Sam McKay

CEO & Founder

How does the CALCULATE 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?

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

Loading

Considerations when using the CALCULATE?

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

Loading

Formula examples using the CALCULATE

=( 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 Courses

Loading