My measure’s total is wrong
In your table or matrix, every row shows the right figure, but the “Total” row is not their sum. It is the problem most often reported on Power BI forums. Rest assured, your formula is not broken. Power BI calculates the “Total” row differently from Excel, and you are going to choose the total that fits.
What the “Total” row does
In Excel, the “Total” row adds up the rows above it. In a Power BI visual, it calculates the measure again, one more time, over all the visible rows. It does not read the figures shown above it.
Each row of the visual has its own filter context, meaning the filters that decide which sales it sees. The New York row keeps only the New York sales. The “Total” row filters no city, and keeps all 12 sales.
Click a row of the visual, then the “Total” row, to see the sales each one keeps.
| City | Revenue |
|---|---|
| 900,000 | |
| 500,000 | |
| 300,000 | |
| 1,700,000 |
| Sale ID | Customer city | Category | Amount |
|---|---|---|---|
| V001 | New York | Sedan | 250,000 |
| V002 | New York | SUV | 150,000 |
| V003 | Chicago | Sedan | 100,000 |
| V004 | Chicago | City car | 100,000 |
| V005 | Toronto | Sedan | 150,000 |
| V006 | New York | Sedan | 200,000 |
| V007 | New York | SUV | 150,000 |
| V008 | New York | City car | 150,000 |
| V009 | Chicago | Sedan | 150,000 |
| V010 | Chicago | SUV | 150,000 |
| V011 | Toronto | SUV | 100,000 |
| V012 | Toronto | City car | 50,000 |
For a sum, calculating again or adding up comes to the same thing. Revenue returns 900,000, 500,000 and 300,000 on the rows, and 1,700,000 on the “Total” row, either way. The total only surprises you with other calculations.
Three cases where the total surprises you
A condition. 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:
| City | Bonus |
|---|---|
| New York | 90,000 |
| Chicago | 50,000 |
| Toronto | 0 |
| Total | 170,000 |
This is a reproduction of the Power BI interface for teaching purposes. It differs from the real interface.
The rows add up to 140,000. The “Total” row calculates the bonus again on 1,700,000, which is over 400,000, and finds 170,000.
A distinct count. We count the customers who bought something, in a table by year:
| Year | Active Customers |
|---|---|
| 2024 | 5 |
| 2025 | 7 |
| Total | 7 |
This is a reproduction of the Power BI interface for teaching purposes. It differs from the real interface.
The rows add up to 12, and the “Total” row shows 7. Five customers bought in both years. They count once in each year, but only once over the whole period.
An average or a ratio. The average price of a car is calculated like this, in a table by city:
| City | Average Price |
|---|---|
| New York | 23,077 |
| Chicago | 21,739 |
| Toronto | 23,077 |
| Total | 22,667 |
This is a reproduction of the Power BI interface for teaching purposes. It differs from the real interface.
The “Total” row divides 1,700,000 by the 75 cars, and finds 22,667. The average of the three rows would give 22,631. It would be wrong, because Chicago, which sells fewer cars, would weigh as much as New York.
Which total is the right one?
Before you fix anything, ask yourself what the total should say. It is a business question, not a formula question.
- The bonus is paid city by city. The total should be the sum of the rows, 140,000.
- There are 7 active customers over the two years. The recalculated total is right, and 12 would count five customers twice.
- The average price of all the cars is 22,667. The recalculated total is right.
In two cases out of three, the recalculated total is the right one. Only the bonus needs a fix.
Getting the sum of the rows with SUMX
You ask DAX to calculate the bonus city by city, then to add up. Let us look again at the “Total” row of the table by city:
“I want the bonus, going city by city through the cities shown, calculating the bonus of each one, then adding them up.”
| City | Total Bonus |
|---|---|
| New York | 90,000 |
| Chicago | 50,000 |
| Toronto | 0 |
| Total | 140,000 |
This is a reproduction of the Power BI interface for teaching purposes. It differs from the real interface.
VALUES provides the visible cities. On the New York row, that is New York alone, and the result does not change. On the “Total” row, it is all three cities. SUMX calculates the bonus of each one, then adds up 90,000, 50,000 and 0.
Call the measure by its name, [Bonus]. Called inside SUMX, it receives an invisible CALCULATE, which turns each city into a filter. Without it, each city would see all the sales.
The lesson on SUMX explains this mechanism in detail. Adding up rows with SUMX
Or show something else on the “Total” row
Sometimes no total makes sense. HASONEVALUE answers TRUE when a single city is visible, so on the city rows, and FALSE on the “Total” row. Let us place this measure in a table by city:
“I want the bonus if only one city is left, otherwise nothing.”
| City | Displayed Bonus |
|---|---|
| New York | 90,000 |
| Chicago | 50,000 |
| Toronto | 0 |
| Total |
This is a reproduction of the Power BI interface for teaching purposes. It differs from the real interface.
The “Total” row stays blank. Instead of BLANK(), you can write another calculation, like the “Total Bonus” measure.
For a matrix with several levels, using ISINSCOPE, see the full lesson. Deciding what the “Total” row shows
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 a table by city, the “Bonus” measure shows 170,000 on the “Total” row, while the rows add up to 140,000. Why?
Question 2
A table by year shows the measure Active Customers = DISTINCTCOUNT( Sales[Customer ID] ). The 2024 row returns 5, the 2025 row returns 7. What does the “Total” row show?
Question 3
A “City” slicer keeps Chicago and Toronto. A table by city shows the measure Total Bonus = SUMX( VALUES( Customers[City] ), [Bonus] ), where “Bonus” is 10% of revenue if it is over 400,000. What does the “Total” row show?
- The “Total” row of a visual calculates the measure again over all the visible rows. It does not add up the rows shown.
- For a sum, both come to the same thing. For a condition, a distinct count or an average, they differ.
- Choosing the right total is a business question. For the sum of the rows, SUMX( VALUES( <column of the visual> ), [Measure] ).