
One of the most common hurdles for Power BI developers is understanding when to use a simple SUM and when to switch to its “X” counterpart, SUMX. While both return a total, they work in fundamentally different ways.
✓ Expert Verified
This documentation has been written and reviewed by our Power BI Experts to ensure technical accuracy and compatibility with the 2026 Power BI Desktop update.
The Core Difference
The difference comes down to Row Context.
- SUM is an Aggregator. It looks at a single column and adds every number in it. It is fast and efficient but cannot perform math across different columns.
- SUMX is an Iterator. It goes through a table row-by-row, performs a calculation (like Price × Quantity), and then sums the results of those individual rows.
1. The SUM Function
Use SUM when your data is already “prepared.” If you have a column called Total Sales, you don’t need row-by-row math; you just need the grand total.
Example Code:
Code snippet
Total Revenue = SUM(Sales[Total_Amount])
👉 View the full technical guide: How to use the SUM Function
2. The SUMX Function
Use SUMX when you need to calculate a value that doesn’t exist as a single column in your data. It is most commonly used for “Price times Quantity” logic.
Example Code:
Code snippet
Calculated Revenue = SUMX(Sales, Sales[Price] * Sales[Quantity])
👉 View the full technical guide: How to use the SUMX Function
Direct Comparison Table
| Feature | SUM | SUMX |
| Logic Type | Aggregator | Iterator |
| Speed | Very Fast | Slightly Slower (on massive data) |
| Complexity | 1 Column only | Multi-column math |
| Requirement | Needs a numeric column | Needs a Table + Expression |
Common Mistake: “The Average of Averages”
A common error is trying to use SUM on a percentage or an average.
- The Error:
SUM(Sales[ProfitMargin%])will give you a meaningless, massive number. - The Fix: You should use SUMX to calculate the profit per row, or better yet, create a “Measure of Measures” where you divide your Total Profit by Total Sales.
Final Verdict
- If the number you want to add up is already in a column: Use SUM.
- If you need to multiply, divide, or logic-check rows before adding them: Use SUMX.
Building Your Dax Library
To see these functions in action with real-world datasets, visit our dedicated chapters:
