09.2Row context

You have met the first question, “Which row am I on?” Its answer is the row context, the row on which DAX is calculating. Let’s see how DAX moves from one row to the next, where you find it, and what it does not do.

09.2.1One row after another

Let’s go back to the Amount column, added to the Sales table like this:

Amount = Sales[Qty] * Sales[Price]
Power BI accepts this DAX forno, Measureyes, Calculated columnno, Calculated tableno, Virtual table

DAX does not calculate the column in one go. It calculates it one row after another, from top to bottom. On the V001 row, it multiplies 10 by 25,000 and writes 250,000. Then it moves to the V002 row, and so on down to V012. Follow it:

DAX calculates the Amount column
Sale IDDateCustomer IDProduct CodeQtyPriceAmount
V0011/15/2024C001A1011025,000
V0023/8/2024C002A202350,000
V0035/20/2024C004A201425,000
V0049/12/2024C005A1021010,000
V00511/25/2024C006A201625,000
V0061/10/2025C001A101825,000
V0072/18/2025C003A202350,000
V0083/27/2025C002A1021510,000
V0095/6/2025C004A201625,000
V0107/14/2025C005A202350,000
V0119/30/2025C007A202250,000
V01212/2/2025C006A102510,000

The table has 12 rows, so the formula is calculated 12 times.

Sales[Qty] and Sales[Price] thus return the quantity and the price of each row. In a row context, a column returns its value for each row.

09.2.2In FILTER too

A calculated column is not the only case where DAX moves from one row to the next. FILTER does it too.

FILTER keeps the rows of a table that meet a condition. To know whether a row meets the condition, it examines it. So it examines each row, one after another.

FILTER( Sales, Sales[Amount] > 150000 )
Power BI accepts this DAX forno, Measureno, Calculated columnyes, Calculated tableyes, Virtual table

On the V001 row, Sales[Amount] is 250,000, more than 150,000. The row is kept. On the V002 row, it is 150,000, which is not greater than 150,000. The row is dropped. Follow FILTER over the 12 rows:

FILTER looks at each row of Sales
Sale IDDateCustomer IDProduct CodeQtyPriceAmountMore than 150,000?
V0011/15/2024C001A1011025,000250,000
V0023/8/2024C002A202350,000150,000
V0035/20/2024C004A201425,000100,000
V0049/12/2024C005A1021010,000100,000
V00511/25/2024C006A201625,000150,000
V0061/10/2025C001A101825,000200,000
V0072/18/2025C003A202350,000150,000
V0083/27/2025C002A1021510,000150,000
V0095/6/2025C004A201625,000150,000
V0107/14/2025C005A202350,000150,000
V0119/30/2025C007A202250,000100,000
V01212/2/2025C006A102510,00050,000

Only V001 and V006 are kept. FILTER returns a table of 2 rows.

09.2.3It hides no row

Excel helps again. In D2, the formula =SUM(C2:C13) adds up the 12 rows of the range. It is written on row 2, but it is not limited to row 2.

DAX works the same way. Let’s add this calculated column to the Sales table:

Total = SUM( Sales[Amount] )
Power BI accepts this DAX foryes, Measureyes, Calculated columnno, Calculated tableno, Virtual table
Total = SUM( Sales[Amount] )
Table Sales
Sale IDAmountTotal
V001250,0001,700,000
V002150,0001,700,000
V003100,0001,700,000
V004100,0001,700,000
V005150,0001,700,000
V006200,0001,700,000
V007150,0001,700,000
V008150,0001,700,000
V009150,0001,700,000
V010150,0001,700,000
V011100,0001,700,000
V01250,0001,700,000
Table: Sales (12 rows)

This is a reproduction of the Power BI interface for teaching purposes. It differs from the real interface.

On the V001 row, you might think SUM adds up only 250,000. Yet it adds up the whole column, and the column shows 1,700,000 on every row. In a calculated column, SUM therefore adds up the whole column, whatever the row.

Watch out!

The row context only says which row you are on. It hides no row. SUM always sees the 12 amounts.

Quiz

The questions often rely on the course tables. Keep them in view in their floating window, which you can move and enlarge.

Question 1

In the Sales table, you add the calculated column Share = Sales[Amount] / SUM( Sales[Amount] ). What is its value on the V001 row?

Question 2

On a card with no filter at all, what does the measure COUNTROWS( FILTER( Sales, Sales[Amount] >= AVERAGE( Sales[Amount] ) ) ) return?

Question 3

In the Sales table, you add the calculated column Count = COUNTROWS( Sales ). What is its value on the V005 row?

Key takeaways
  • DAX calculates a calculated column one row after another. FILTER also looks at each row, one after another.
  • In a row context, a column like Sales[Amount] returns its value for each row.
  • The row context hides no row. In a calculated column, SUM therefore adds up the whole column.