Understanding Row Context
The current row pointer inside calculated columns and iterators.
Conceptual foundationOverview
Row Context refers to the awareness of the current row being scanned. It exists automatically in calculated columns and is created by iterators like SUMX and FILTER.
Crucially, Row Context DOES NOT filter the data model! A calculated column scanning row 5 cannot automatically see related sales or filter visuals. To turn a row context into a filter context, you must trigger Context Transition using CALCULATE.
// Row context exists here:
Profit = Sales[Revenue] - Sales[Cost]When to use Understanding Row Context
- Calculated columns that compute a value for each row of a table.
- Iterators (SUMX, AVERAGEX, FILTER) that evaluate an expression row by row.
- Reading values from related tables with RELATED inside a row context.
Worked examples
Calculated column with RELATED
Line Margin =
Sales[Amount] - Sales[Quantity] * RELATED ( 'Product'[Unit Cost] )In a calculated column on Sales, each row has a row context, so Sales[Amount] refers to the current row. RELATED follows the relationship to read the product's cost.
Row context inside an iterator
Total Margin =
SUMX (
Sales,
Sales[Amount] - Sales[Quantity] * RELATED ( 'Product'[Unit Cost] )
)The same logic as a measure: SUMX creates a row context for each Sales row. Unlike the calculated column, nothing is stored, and the result responds to slicers.
Common mistakes
- Assuming Row Context filters relationships—it does not! You must use RELATED or Context Transition.
- Creating dozens of unnecessary calculated columns instead of measures.
Performance notes
Row context means row-by-row work. Simple column arithmetic in an iterator is pushed to the storage engine and is fast, but calculated columns on very large fact tables cost memory and refresh time, and complex expressions in iterators can force slow formula-engine evaluation.
Frequently asked questions
- Does row context filter data?
- No. A row context only identifies the current row. To turn it into a filter (for example to evaluate a measure for that row), CALCULATE performs context transition.
- Why can't I reference a column in a measure without an aggregation?
- A measure has no row context unless you create one with an iterator, so a bare column reference has no current row to read. Aggregate it (SUM, MAX) or iterate a table.
- When should I use RELATED vs LOOKUPVALUE?
- Use RELATED when a relationship exists; it is simpler and faster. LOOKUPVALUE is for lookups without a relationship.