15.1Adding up rows with SUMX

In Excel
ExcelSUMPRODUCT, or SUM(E2:E13*F2:F13)
Match

As you have seen, the “Total” row recalculates the measure, and does not add up the rows. For an average price, that is what you want. For a bonus calculated city by city, it is not. Here is how to get the sum of the rows.

15.1.1A surprising total

Each city earns a 10% bonus if its revenue is over 400,000. Let us place this measure in a table by city, and look at the “Total” row:

Bonus = IF( [Revenue] > 400000, [Revenue] * 0.1, 0 )
Power BI accepts this DAX foryes, Measureyes, Calculated columnno, Calculated tableno, Virtual table
Table visual, The “Bonus” measure by city
CityBonus
New York90,000
Chicago50,000
Toronto0
Total170,000

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

The rows make 140,000. The “Total” row, for its part, recalculates the bonus on 1,700,000, which is over 400,000, and finds 170,000. Power BI did not make a mistake. This row has its own calculation, and this total surprises almost everyone who is starting out.

The rest of this lesson is part of izyDAX Pro

You have just read the first section. The next 2, their animations, the exercises and the summary are waiting for you with izyDAX Pro, in a single payment.