Fixing Wrong Totals in Measures
Part of the Power BI Roadmap
In short
Every row in your commission table looks right, but the total is way off, and your manager spots it in two seconds. The total isn't wrong by accident: it's the measure doing exactly what you told it, just on all rows at once.
The total row re-evaluates a measure over all rows instead of adding the visible rows, so measures with IF or MAX logic can show totals that look wrong. Iterating over the row values with SUMX fixes this.

Think of it like this
The restaurant bill with a combo offer
"Free dessert on orders above ₹1,000." Four friends each order ₹400, so nobody qualifies. But if the waiter checks the rule on the combined ₹1,600 bill, suddenly there's a free dessert. The total row in Power BI is that combined bill: it re-applies the rule to everything together instead of adding up each person's result.
Watch it happen
Commission: 5% only above ₹1,00,000 per salesperson
1/4Each row checks the rule for one salesperson. Only Bhavna crosses ₹1 lakh.
The big ideas
What you need to know
Totals don't add rows
The total cell runs the measure again with all rows in context. For SUM that matches, for IF or MAX logic it often doesn't.
Iterate at the right grain
SUMX ( VALUES ( key ), [measure logic] ) calculates per item and adds, so the total equals the sum of the rows.
Check with ISINSCOPE
When a total should show something different, like a blank or an average, ISINSCOPE tells you whether you're on a detail row.
Iterate over keys
Use an ID column in VALUES, not a name, so two people called Rahul Sharma aren't merged into one.
See it in code
Walk through the code
1Commission (Wrong Total) =2IF ( [Total Sales] > 100000, [Total Sales] * 0.05, 0 )3 4Commission =5SUMX (6 VALUES ( Employee[EmployeeID] ),7 VAR EmpSales = [Total Sales]8 RETURN IF ( EmpSales > 100000, EmpSales * 0.05, 0 )9)10 11Max Daily Sales (Detail Only) =12IF (13 ISINSCOPE ( 'Date'[Date] ),14 [Total Sales],15 MAXX ( VALUES ( 'Date'[Date] ), [Total Sales] )16)1/4Correct on each person's row, but the total applies the rule to everyone's sales combined.
The same commission rule, wrong at the total and then fixed, plus a deliberate total using ISINSCOPE.
Save yourself the pain
Common mistakes
Oops
Fixing the total by hiding it in the visual.
Do this instead
Hidden totals still feed cards and charts elsewhere. Fix the measure so it's right at every level.
Oops
Using SUMX ( Sales, ... ) row by row for a per-salesperson rule.
Do this instead
Iterate at the grain the rule applies to. A rule per salesperson needs VALUES of the employee key, not every sales line.
Your mission
Catch a broken total
Quick check
Why does an IF-based measure often show a strange total?
Go deeper
- 1Build a measure whose total doesn't match the sum of its rows.
- 2Fix it with SUMX over VALUES of the row column.
- 3Explain to a friend why the total row is not a simple sum.
More topics at this stop
Stuck on this topic? Ask an Insider
Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.