Skip to main content
Albero Academy

Filter Context & CALCULATE

The heart of DAX — what filter context is, how visuals create it, and how CALCULATE modifies it to build powerful measures.

Chapter 9Power BI16 min readBeginner friendly
  • #Power BI
  • #DAX
  • #CALCULATE

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:

the same measure, different contexts
Total Sales = SUM(Sales[Amount])
In a matrix:
North South Total
January £5k £3k £8k ← each cell filters by its row+column
February £6k £4k £10k
Total £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:

CALCULATE(expression, filters…)
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:

building a % of total
% 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:

ignore filters
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

  1. 01Filter context is the set of filters applied to a cell — from headers, slicers and page filters.
  2. 02A measure computes within the current filter context, so it returns the right value everywhere.
  3. 03CALCULATE evaluates an expression under a modified filter context — the most important DAX function.
  4. 04Filters passed to CALCULATE replace that column's filter — the basis of comparisons.
  5. 05ALL()/REMOVEFILTERS() strip filters — essential for % of total, ranks and running totals.