In short
CALCULATE is the most important function in DAX. Every "sales for this category only", "last year's sales" or "share of total" measure is CALCULATE changing the filters before a measure runs.
CALCULATE evaluates an expression in a modified filter context. It can add, replace or remove filters, and it is the most important function in DAX.

Think of it like this
Swapping lenses
An optician puts different lenses in front of your eyes: one makes everything look closer, one blocks glare, one removes a blur. You're looking at the same street through a changed lens. CALCULATE swaps the filter lens, then evaluates the measure through it.
Watch it happen
How CALCULATE evaluates a cell
1/4A matrix cell for City = Pune, Category = Dairy. These are the starting filters.
The big ideas
What you need to know
CALCULATE ( expression, filters... )
First the expression, then any number of filter arguments. All filters are combined with AND.
Filters replace by default
A filter on a column overrides any existing filter on that same column. Other columns keep their filters.
Can remove filters too
REMOVEFILTERS and ALL as arguments clear filters instead of setting them.
Triggers context transition
In a row context, CALCULATE turns the current row into a filter. More on this in its own lesson.
See it in code
Walk through the code
1Snacks Sales =2CALCULATE ( [Total Sales], 'Product'[Category] = "Snacks" )3 4Pune Online Sales =5CALCULATE (6 [Total Sales],7 Store[City] = "Pune",8 Sales[Channel] = "Online"9)10 11Big City Sales =12CALCULATE (13 [Total Sales],14 Store[City] IN { "Mumbai", "Delhi", "Bengaluru" }15)1/3In a matrix by category, every row shows snack sales, because the Category filter is replaced.
Three CALCULATE patterns: one filter, two filters combined with AND, and a list with IN.
Save yourself the pain
Common mistakes
Oops
Expecting Snacks Sales to show Dairy's sales on the Dairy row.
Do this instead
The argument replaces the Category filter, so every row shows snacks. Use KEEPFILTERS if you want it to intersect instead.
Oops
Writing CALCULATE ( [Total Sales], [Total Sales] > 1000 ).
Do this instead
A boolean filter argument can't use a measure. Use FILTER over a column, like FILTER ( VALUES ( Store[City] ), [Total Sales] > 1000 ).
Your mission
Five CALCULATE measures
Quick check
In a matrix with Category on rows, what does CALCULATE ( [Total Sales], 'Product'[Category] = "Snacks" ) show on the Beverages row?
Go deeper
- 1Write Sales Mumbai = CALCULATE ( [Total Sales], Store[City] = "Mumbai" ).
- 2Put it in a visual sliced by city and explain the result in every row.
- 3Practise until you can predict CALCULATE's output before running it.
More topics at this stop
Stuck on this topic? Ask an Insider
Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.