Overview
SUM operates at the column level—it adds one column under active filters and cannot do Quantity × Price inside its brackets. SUMX is an iterator: it loops row-by-row, runs an expression per row, then sums the results.
Column-level aggregation versus row-by-row iterators.
On this page
SUM operates at the column level—it adds one column under active filters and cannot do Quantity × Price inside its brackets. SUMX is an iterator: it loops row-by-row, runs an expression per row, then sums the results.
SUM(<column>)SUMX(<table>, <expression>)A billing table named SalesTransactions:
Sample Data Table: SalesTransactions
| TransactionID | Product | Quantity | UnitPrice |
|---|---|---|---|
| T_01 | Desk | 2 | 200 |
| T_02 | Chair | 5 | 50 |
| T_03 | Lamp | 10 | 20 |
You cannot use SUM(SalesTransactions[Quantity] * SalesTransactions[UnitPrice])—SUM will throw a syntax error. Use SUMX (recommended):
Total Revenue (SUMX) =
SUMX(
SalesTransactions,
SalesTransactions[Quantity] * SalesTransactions[UnitPrice]
)// Requires a physical [LineTotal] column first
Total Revenue (SUM) = SUM(SalesTransactions[LineTotal])Note
Avoid Approach 2—physical columns increase Power BI file size and waste RAM.
Output Table Visual
| Product | Quantity (SUM) | Unit Price (Avg) | Total Revenue (SUMX) |
|---|---|---|---|
| Desk | 2 | 200 | 400 (2 × 200) |
| Chair | 5 | 50 | 250 (5 × 50) |
| Lamp | 10 | 20 | 200 (10 × 20) |
| Total | 17 | 90 | 850 |
SUMX calculated 2×200=400, 5×50=250, and 10×20=200, then summed to $850—without creating extra physical columns.