Context transition
From a current row to a filter
An iterator supplies a current row, but an aggregate alone does not use that row as a restriction. Context transition makes the current row values part of the filter context. In this model the unique product key and the active relationship make product-level aggregation possible. Use the clean Import model from Chapter 20. FactSales has five lines, RevenueUSD and Quantity; DimProduct contains ProductKey, Product and Category; DimRegion contains Region. Active one-to-many relationships filter the fact from each dimension. Use dimension columns for selections, no RLS, no other report filters, and fixed USD. Reuse the existing [Context Revenue] measure (SUM(FactSales[RevenueUSD])). Every formula below is a separate measure unless identified as a query or column. Expected results are fixture-derived; native DAX execution is NOT RUN.
Example 1 — Diagnose a repeated total
Repeat Revenue Bug =SUMX(DimProduct, SUM(FactSales[RevenueUSD]))Transition Revenue =SUMX(DimProduct, CALCULATE(SUM(FactSales[RevenueUSD])))The first formula is deliberately wrong for a sum of product revenue: without selections, each of the three products sees the same 200 USD aggregate, producing 600. The corrected formula applies context transition for each product: Notebook 60, Desk Lamp 90, Backpack 50; total 200. Under North, the incorrect result is 312, the corrected total 104. The three dimension rows remain visible under North because the relationship does not filter DimProduct from FactSales. Transition can use all current row columns, not an implicit physical row ID. These keys are unique.
Example 2 — Measure calls and variable placement
Measure Iteration = SUMX(DimProduct, [Context Revenue])Frozen Revenue Bug =VAR BeforeIteration = [Context Revenue]RETURN SUMX(DimProduct, BeforeIteration)Calling the model measure in a row context implicitly performs context transition. Measure Iteration gives 200 unfiltered and 104 under North, matching Transition Revenue. The intentionally incorrect variable version captures the outer scalar once; it repeats 200 three times, or 104 three times under North. Moving the variable inside the iterator would bind the measure result at the product context instead. A variable is a value bound where its expression is evaluated, not a formula macro that automatically recomputes under later filters.
Evaluation order matters
For ordinary explicit filter expressions, reason about their values in the original evaluation context, then context transition, then the modifiers and explicit filters that shape the context for the first argument. A later explicit filter can override a transitioned restriction. Do not assume that the transition automatically affects the evaluation of sibling filter arguments. For a genuinely dependent filter, use nested CALCULATE or capture the needed row value explicitly. This is a conceptual rule, not a physical engine execution trace. CALCULATE without filter arguments still performs transition. Avoid diagnostic stored columns in a production model merely to observe this effect.
Practice — trace the iterator
Under South, predict Repeat Revenue Bug, Transition Revenue and Measure Iteration. Explain the role of Backpack, which has no South fact rows. Repeat under South + Home. Explain why the bug can appear to work when just one product is selected.
Official reading
CALCULATE · Order · Transition