Data Dictionary

Filter context and row context

What is filter context and row context?

Filter context and row context are the two ways DAX decides which data a formula looks at while it runs. Every calculation in Power BI is evaluated inside one or both of them. Once you can read them, most confusing results stop being a mystery.

Row context is "the current row". Filter context is "the set of filters currently applied to the model". They are not the same thing and they do not do the same job, which is exactly why they trip people up.

Row context

Row context means DAX is working through a table one row at a time and knows which row it is on. A calculated column gets a row context automatically: the formula runs once per row and can read the value of any column in that row.

Here is a calculated column that multiplies quantity by price for every line in a Sales table.

Line Total = Sales[Quantity] * Sales[Unit Price]

DAX walks down the table, and on each row it reads that row's quantity and price. Iterator functions like SUMX, AVERAGEX and FILTER create the same kind of row context: they loop over a table and give you the current row inside the expression you pass them.

One thing row context does not do on its own is filter the model. It knows the current row, but it will not automatically restrict a SUM over the whole table. That is the job of filter context.

Filter context

Filter context is the collection of filters active when a calculation runs. In a report those filters come from everywhere the reader can touch: the rows and columns of a visual, slicers, the filter pane, and cross-filtering from other visuals. A relationship also passes filter context from one table to another.

Take a plain measure.

Total Sales = SUM(Sales[Amount])

Drop it in a card and it sums every row. Put it in a bar chart by country and each bar shows a different number, because each bar carries its own filter context: one country at a time. Click March in a slicer and the filter context narrows again to March. The formula never changes, only the filter context around it does.

You can also set filter context yourself inside a formula. CALCULATE is the function built for that, and functions such as ALL, REMOVEFILTERS and KEEPFILTERS add, clear or adjust filters on purpose.

How the two work together

Filter context does not exist in place of row context. It applies on top of it. A calculated column runs in row context, and if you wrap an aggregation in CALCULATE inside that column, DAX turns the current row into a filter. That move has its own name, context transition, and is worth reading about on its own. A measure starts life in filter context, and an iterator inside it adds a row context for the duration of the loop.

A short mental test helps. Ask "does this formula need to know the current row, or the current set of filters?" A calculated column and the inside of an iterator lean on row context. A measure sitting in a visual lives in filter context. A calculation group leans on the same idea from the other side: it reshapes the filter context so one piece of logic, such as a year-to-date or prior-year variant, can apply across many measures at once.

Why context is the core DAX skill

Nearly every "my number is wrong" moment in Power BI comes back to context. The formula is fine; the context around it is not what the author assumed. A measure looks correct in a card and then drops in a table because a slicer added a filter nobody noticed. A calculated column returns the grand total on every row because it had row context but no filter context, so the aggregation saw the whole table.

The two contexts also sit close to performance. The VertiPaq engine that holds an imported model in memory is quick at answering filtered aggregations, so a measure that lets filter context do the work usually beats a pile of calculated columns that store the same numbers row by row.

What to watch out for with filter context and row context

  • Expecting row context to filter. A bare SUM in a calculated column ignores the identity of the current row unless you force a transition with CALCULATE. Without it you get the total of the whole column on every row.

  • Forgetting a filter that is already there. Slicers, the filter pane and the visual itself all add to filter context silently. When a number surprises you, list every filter acting on that cell before you touch the formula.

  • Two-way relationships spreading filters. Bidirectional filtering can push filter context in directions you did not plan, which changes results and can slow the model. Keep relationships single-direction unless you have a reason.

  • Heavy expressions inside iterators. An iterator sets up a row context for every row it visits. A costly calculation inside a loop over millions of rows adds up. Move logic out of the loop where you can.

Last Updated: July 17, 2026 Back to Dictionary
Keywords
filter context row context DAX evaluation context context transition calculation group VertiPaq Power BI semantic model business intelligence