Stop 08 · Filter Context & CALCULATETopics · 1/9

Row Context vs Filter Context

Part of the Power BI Roadmap

In short

Almost every "why is my DAX wrong?" question comes down to one idea: is this formula looking at one row, or at a set of filtered rows? Learn these two contexts and DAX stops feeling random.

Filter context is the set of filters from slicers, visuals and matrix rows that decide which data a measure sees. Row context means 'the current row', which exists in calculated columns and iterators.

On one side the jaadu marks a single answer sheet with a red pen, and on the other side peers through a big magnifying glass at one labelled bundle pulled from a tall stack of papers.

Think of it like this

A teacher marking papers vs the principal reading a report

A teacher marks one answer sheet at a time and only sees that student's answers: row context. The principal asks, "Show me Class 9B's maths average for Term 2", and sees only the sheets that match: filter context. Same papers, two very different ways of looking.

Watch it happen

Two contexts

Row context

  • "The current row"
  • Exists in calculated columns
  • And inside iterators like SUMX, FILTER
  • Lets you read Sales[Qty] for this row

Filter context

  • "Which rows are visible"
  • Comes from slicers, visual rows, columns, filters
  • Applied to every measure in that cell
  • Changed with CALCULATE

Row context does not filter anything by itself. Only filter context decides which rows an aggregation like SUM sees.

The big ideas

What you need to know

Row context reads one row

In a calculated column, Sales[Qty] * Sales[Price] uses the values of the row being computed.

Filter context picks rows

In a matrix cell for Pune and April, every measure only sees Pune's April rows.

Row context doesn't filter

SUM ( Sales[Amount] ) in a calculated column returns the grand total on every row, because no filter is applied.

Iterators make row context

SUMX, AVERAGEX and FILTER loop over a table, creating a row context for each row.

See it in code

Walk through the code

dax
1-- Calculated column on Sales (row context)2Line Amount = Sales[Qty] * Sales[Unit Price]3 4-- Calculated column on Sales: same SUM on every row!5Grand Total Col = SUM ( Sales[Amount] )6 7-- Measure (filter context from the visual)8Total Sales = SUM ( Sales[Amount] )

1/3Row context: each row multiplies its own Qty and Unit Price.

The same SUM behaves very differently as a column and as a measure.

Save yourself the pain

Common mistakes

Oops

Writing a calculated column with SUM and expecting a per-customer total.

Do this instead

Row context doesn't filter. Use CALCULATE ( SUM ( ... ) ) in the column, which converts the row into a filter, or use a measure.

Oops

Thinking a measure knows "the current row" of the fact table.

Do this instead

Measures run in filter context. If you need row-by-row logic inside a measure, use an iterator like SUMX.

Your mission

Feel both contexts

~20 min

Quick check

A calculated column on Sales is defined as SUM ( Sales[Amount] ). What does each row show?

Go deeper

  1. 1Put one measure in a matrix and explain why each cell shows a different value.
  2. 2Write a calculated column and note it has row context but no filter context by default.
  3. 3Read the SQLBI article on row context and filter context.

More topics at this stop

Stuck on this topic? Ask an Insider

Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.

Download
InsideEdge