(+351) 21 24 10006  ·  info@bconcepts.pt
Carnaxide, Lisbon
DAX: the difference between SUM and SUMX explained with examples
Power BI

DAX: the difference between SUM and SUMX explained with examples

Equipa bConcepts 08/11/2023 2 min

In DAX, two functions seem to do the same thing but hide a fundamental difference: SUM and SUMX. Choosing the wrong one gives wrong totals — and worse, the error often goes unnoticed. Understanding when to use each is a milestone in mastering DAX.

SUM: adding up a column

SUM adds up the values of a single existing column. SUM(Sales[Amount]) returns the total of the Amount column. Simple and direct — when the number you want is already in a column, this is what you use.

DAX: the difference between SUM and SUMX explained with examples

SUMX: calculate row by row, then sum

SUMX is an "iterator": it goes through the table row by row, computes an expression on each, and only then sums it all. SUMX(Sales, Sales[Quantity] * Sales[Price]) multiplies quantity by price on each row and sums the results.

The difference that changes the result

The classic mistake is doing SUM(Quantity) * SUM(Price) to get total revenue. That multiplies two totals and gives a completely wrong number. The correct way is SUMX: multiply row by row and only then sum. The order of operations is everything.

When to use each

  • SUM: when the value you want already exists in a column ready to sum.
  • SUMX: when you need to compute something per row (multiply, condition) before summing.

The pattern applies to the whole X family

DAX has AVERAGEX, MAXX, MINX, COUNTX — all iterators with the same logic: compute row by row then aggregate. Understanding SUMX is understanding the whole family, one of the most important ideas in DAX.

In practice

Whenever you need a calculation involving more than one column per row, think SUMX, not SUM of separate columns. This care avoids wrong totals nobody catches until it is too late. Do your revenue calculations multiply row by row, or sum separate columns?

← Back to insights
Let's talk?

Ready to transform your data?

Book a free 30-minute meeting and find out how we can help your team make better decisions.

Book a Free Meeting
bConcepts