Back to PowerBI & DAX Measures
PowerBI & DAX Measures

How do filter context and row context work in DAX, and when should you use CALCULATE()?

Filter context filters rows, row context evaluates each row, and CALCULATE switches row context to filter context for advanced filtering.

I
Ishaan Patel 👑 Tier 3 Elite
Aug 9, 2026 · 2 min read

Filter context determines which rows are visible to a measure, while row context evaluates each row individually; CALCULATE triggers a context transition, converting row context to filter context.

How the contexts work

1. Row context – created automatically by iterators (SUMX, FILTER, ADDColumns). It lets you reference columns of the current row ([Sales], RELATED(Product[Category])).
2. Filter context – built from visual filters, slicers, and explicit filter functions (CALCULATE, FILTER, ALL). It restricts the data set before aggregation.
3. Context transition – when CALCULATE is evaluated, any existing row context is turned into an equivalent filter context, allowing row‑level calculations to affect the overall filter set.

Quick comparison

| Aspect | Row Context | Filter Context |
|-------------------|---------------------------------|------------------------------------|
| Origin | Iterator functions | Visuals, slicers, CALCULATE |
| Access | Direct column reference ([Col]) | Implicit via aggregation (SUM) |
| Conversion | → via CALCULATE (context transition) | N/A |

When to use CALCULATE

- You need to modify the current filter set (add, replace, or remove filters).
- You want to apply time‑intelligence (TOTALYTD, SAMEPERIODLASTYEAR).
- You must perform a context transition inside a row‑context iterator.

Decision checklist

- ☐ Is the measure inside an iterator (SUMX, FILTER)? → Use CALCULATE to convert row to filter context.
- ☐ Do you need to override a slicer selection? → Add a filter argument in CALCULATE.
- ☐ Are you calculating a running total or YTD value? → Wrap the time‑intelligence function in CALCULATE.

Example

Sales LY :=
CALCULATE(
    SUM(Sales[Amount]),
    SAMEPERIODLASTYEAR('Date'[Date])
)
Top3 Products :=
CALCULATE(
    SUMX(
        TOPN(3, VALUES(Product[Name]), [Sales], DESC),
        [Sales]
    )
)

Read the evidence

Sources used in this thread

Open the original material, compare the claims, and form your own view.

Community notes

Add context, not noise (0)

Corrections, lived experience, useful examples, and better sources belong here.

Nothing added yet. Be the first to make this thread more useful.
Click here to write a reply...
🔒

Authentication Required

Join Trendzza to begin your journey. Submit tasks, complete batches, help peers, and earn your way to Tier 3.