Filter context is the single most important concept in DAX — and the one that takes a beginner to competent. Once you understand that measures compute within a "filter context" created by the report, and that CALCULATE lets you change that context, all of DAX opens up.
What is filter context?
Every cell in a Power BI visual has a filter context — the set of filters that apply to it. A Total Sales value in the "January / North" cell of a matrix is computed with the filters Month = January and Region = North. The row/column headers, slicers and page filters all contribute:
Total Sales = SUM(Sales[Amount])In a matrix:North South TotalJanuary £5k £3k £8k ← each cell filters by its row+columnFebruary £6k £4k £10kTotal £11k £7k £18k ← grand total: no month/region filter
CALCULATE
CALCULATE is the most important DAX function. It evaluates an expression under a modified filter context — you give it filters that add to, replace or remove the current ones:
Sales North = CALCULATE([Total Sales], Region[Name] = "North")-- Always North, regardless of what the visual is showing.Sales 2026 = CALCULATE([Total Sales], 'Date'[Year] = 2026)
Filter modifiers
The filters you pass to CALCULATE normally replace that column's existing filter. This is how you compute comparisons:
% of Region =DIVIDE([Total Sales],CALCULATE([Total Sales], ALL(Region)) -- total ignoring the region filter)-- Numerator respects the current region; denominator is the all-region total.
ALL & REMOVEFILTERS
ALL() (and its clearer alias REMOVEFILTERS()) removes filters from a table or column — essential for "% of total", ranks and running totals, where the denominator must ignore the current slice:
Total All Products = CALCULATE([Total Sales], ALL(Product))Grand Total = CALCULATE([Total Sales], ALL(Sales))
Practice
Build Total Sales and put it in a matrix by month and region — observe each cell's filter context. Write Sales North with CALCULATE, and a % of Region measure using ALL(Region) in the denominator. Confirm the percentages sum to 100% down each region.
Key takeaways
- 01Filter context is the set of filters applied to a cell — from headers, slicers and page filters.
- 02A measure computes within the current filter context, so it returns the right value everywhere.
- 03CALCULATE evaluates an expression under a modified filter context — the most important DAX function.
- 04Filters passed to CALCULATE replace that column's filter — the basis of comparisons.
- 05ALL()/REMOVEFILTERS() strip filters — essential for % of total, ranks and running totals.
