Row Context is one of the most important concepts in DAX. It refers to the current row being evaluated when a formula is calculated.
In simple terms, Row Context means DAX is working one row at a time.
Row Context is automatically created in Calculated Columns and inside iterator functions such as SUMX, AVERAGEX, and FILTER.
Row Context in Calculated Columns
When you create a calculated column, DAX automatically evaluates the formula for each row in the table.
Example
Profit = Sales[Revenue] - Sales[Cost]
Here, DAX calculates Revenue minus Cost for each individual row in the Sales table.
Each row has its own result because the formula runs row by row.
This is Row Context.
Row Context in Iterator Functions
Iterator functions create Row Context manually while looping through a table.
Example using SUMX
Total Revenue = SUMX(Sales, Sales[Quantity] * Sales[Unit Price])
SUMX goes through each row in the Sales table, multiplies Quantity by Unit Price, and then sums the results.
Even though this is a Measure, SUMX creates Row Context during calculation.
Important Difference
Calculated Columns always have Row Context.
Measures do not automatically have Row Context unless an iterator function is used.
This is why simple column references work in calculated columns but may require aggregation in measures.
Why Row Context is Important
- Helps perform row-by-row calculations
- Essential for understanding calculated columns
- Required when using iterator functions
- Helps avoid common DAX errors
Common Confusion
Row Context is different from Filter Context.
Row Context works on a single row at a time.
Filter Context works on filtered sets of data based on visuals and slicers.
Understanding Row Context is the foundation for mastering advanced DAX concepts.