09.6The “Total” row recalculates the measure

In Excel, you are used to the “Total” row adding up the rows above it. In a Power BI visual, it does something else. Don’t worry, it is not a flaw, and you are about to see why.

09.6.1A context like any other

Each row of a visual is a separate calculation, with its own filter context. The New York row keeps only the New York sales.

The “Total” row is a separate calculation too. Its context filters no city. Power BI recalculates the measure there over all the visible sales. It does not add up the rows shown above.

Click a row of the visual, then the “Total” row, to see the sales each one keeps.

The visual by city, and the visible sales of each row
CityRevenue
900,000
500,000
300,000
1,700,000
Sale IDCustomer cityCategoryAmount
V001New YorkSedan250,000
V002New YorkSUV150,000
V003ChicagoSedan100,000
V004ChicagoCity car100,000
V005TorontoSedan150,000
V006New YorkSedan200,000
V007New YorkSUV150,000
V008New YorkCity car150,000
V009ChicagoSedan150,000
V010ChicagoSUV150,000
V011TorontoSUV100,000
V012TorontoCity car50,000
SUM( Sales[Amount] ) returns 900,000

The “Total” row keeps the 12 sales. SUM adds them up directly, without going through the three rows.

09.6.2When the total changes everything

For a sum, both ways give the same total. For a division, like an average price, they differ. Let’s place this measure in a table by city, and look at the “Total” row:

Average Price = DIVIDE( SUM( Sales[Amount] ), SUM( Sales[Qty] ) )
Power BI accepts this DAX foryes, Measureyes, Calculated columnno, Calculated tableno, Virtual table
Table visual, The “Average Price” measure by city
CityAverage Price
New York23,077
Chicago21,739
Toronto23,077
Total22,667

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

New York sells 39 cars for 900,000, Chicago 23 for 500,000, Toronto 13 for 300,000. The “Total” row divides 1,700,000 by the 75 cars, and finds 22,667.

The average of the three row prices would give 22,631. It would be wrong, because Chicago would weigh as much as New York, even though it sells fewer cars. Here, the recalculation of the “Total” row gives the right average price.

Tip

Sometimes, on the contrary, you expect the sum of the rows, and the recalculation comes as a surprise. This case has its own chapter, later, with its solutions. If the total of your own visual already surprises you, the Diagnostic guides you step by step.

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

What does Power BI do to show the “Total” row of a visual?

Question 2

A visual by category shows the measure DISTINCTCOUNT( Sales[Customer ID] ). The rows show 3 for sedans, 4 for SUVs and 3 for city cars. What does the “Total” row show?

Question 3

A visual by city shows the measure AVERAGE( Sales[Amount] ). The rows show 180,000 for New York, 125,000 for Chicago and 100,000 for Toronto. What does the “Total” row show?

Key takeaways
  • The “Total” row of a visual recalculates the measure, in a context that filters none of the row values.
  • For a sum, the recalculated total equals the sum of the rows. For a division, an average or a condition, it can differ.