Fix totals that don’t add up with SUMX and VALUES

Why a matrix total can disagree with its rows, and how SUMX over VALUES makes a per-customer rule add up correctly.

You will learn to

  • Explain why a measure is recalculated on the total row instead of adding up the rows
  • Apply a rule per customer with SUMX over VALUES
  • Recognize measures whose totals need an iterator

How it works

A matrix total is **not** the sum of the rows above it. Power BI calculates the measure again, once, with the total row’s filters, which usually means no filter at all.

For a plain sum that gives the same answer. For a rule like **“pay a $250 bonus when a customer’s sales reach $10,000”** it doesn’t: on the total row, `[Total Sales]` is the whole shop’s sales, the rule fires once, and the total shows $250 no matter how many customers earned it.

The fix is to apply the rule at the right grain and add the results yourself: iterate the visible customers with `SUMX(VALUES(Customer[Customer]), …)`. On a customer row the list has one customer, so nothing changes; on the total row it has all of them, and the bonuses add up.

Practice it hands-on with a real data model and a live report that updates as you type.

Months Over 15K = SUMX(VALUES('Date'[Month Year]), IF([Total Sales] >= 15000, 1))