Sub topic 1
What Filter Context Is
Prerequisites
This chapter assumes you can already:
- Write a basic DAX measure such as
SUM ( Sales[Amount] ). - Read a star-schema model, with dimension tables on the one side of one-to-many relationships and a fact table on the many side.
- Place fields in a report's rows, columns and slicers.
The idea in one sentence
Filter context is the set of filters that is active when DAX evaluates an expression. A measure has no fixed answer. It returns a result for whatever rows the current filter context leaves visible.
Start with a base measure:
Total Sales = SUM ( Sales[Amount] )This one definition returns a different number in each cell of a report. The formula never changes. The filter context does.
Where filter context comes from
Filter context is built from the report layout and from DAX code:
- Row and column headers. A matrix row for
'Product'[Category] = "Bikes"filters the measure to Bikes. - Slicers and report, page or visual filters. Each one adds a filter on a column.
- CALCULATE and its filter arguments. These change the context from inside a formula. Later chapters cover them.
Several filters combine with AND logic. If a matrix row shows Bikes and a slicer selects year 2025, the measure sees only rows that are Bikes and 2025.
A worked example
Suppose the Sales table holds these rows:
| Product color | Category | Year | Amount |
|---|---|---|---|
| Red | Bikes | 2024 | 100 |
| Red | Bikes | 2025 | 150 |
| Black | Bikes | 2025 | 200 |
| Red | Clothing | 2025 | 50 |
(In the real model, color and category live in 'Product' and year lives in 'Date'. They are shown together here for readability.)
The table below shows what [Total Sales] returns under different filter contexts.
| Filter context | Rows visible | [Total Sales] |
|---|---|---|
| None (a card visual with no filters) | All four | 500 |
| Category = Bikes | First three | 450 |
| Category = Bikes, Year = 2025 | Rows 2 and 3 | 350 |
| Color = Red, Year = 2025 | Rows 2 and 4 | 200 |
In each case DAX first filters the model, then runs SUM over the rows that remain.
Seeing filter context in a diagram
Filters are on columns, not on cells
A filter in the context applies to a column. It states which values of that column are allowed. This detail matters in later chapters, because a filter on 'Product'[Color] can be replaced, removed or kept without touching filters on other columns.
You can inspect the filters that are active on a column with functions such as VALUES and SELECTEDVALUE. This measure returns the selected color, or a message when zero or several colors are visible:
Selected Color =
SELECTEDVALUE ( 'Product'[Color], "Several or none" )Add it next to [Total Sales] in a matrix to see the context change from row to row.
Common misreadings
- "The measure sums the whole table." It sums only the rows visible after filtering. With no filters, that happens to be the whole table.
- "A slicer changes the formula." The formula is unchanged. The slicer adds a filter to the context.
- "Filter context only comes from the report." DAX functions, especially CALCULATE, can create and modify it too.
What comes next
The next chapter shows how a filter on a dimension table reaches the fact table through relationships, which is why a filter on 'Product'[Category] affects Sales[Amount].
Exercise
Using the example Sales table above, a matrix row shows Color = Black and a slicer selects Year = 2025. What does [Total Sales] return, and why?
Show answer
It returns 200. The two filters combine with AND, so only the third row (Black, Bikes, 2025, 200) stays visible, and SUM adds that single amount.
Exercise
A colleague says that adding a slicer rewrites the DAX formula of [Total Sales]. Explain what actually happens.
Show answer
The formula stays the same. The slicer adds a filter on a column to the filter context, which reduces the rows visible to the formula, so the same expression returns a different result.