- The bill has Qty and Rate. No amount per line yet, like a table without a NetAmount column.
- SUMX = the careful waiter. For each line: qty × rate, then add them all up.
- SUM = amount already printed. Once each line has its amount, just add the column.
- The wrong shortcut. Total plates × average rate overcharges you. Prices differ line by line.
Order Lines
Green row = current SUMX iterationResult Comparison
Same filter context, different logicSUM of existing column
$0Best when the table already stores a reusable numeric column like NetAmount.
SUMX of row expression
$0Best when the amount must be computed per row using quantity, price, discount, tax, margin, or exchange rate.
Common wrong shortcut
$0SUM(Qty) * AVERAGE(UnitPrice) * (1 - AVERAGE(Discount)) can look convenient but often gives the wrong business result.
When to use which
And why X functions matterExplain more
Use SUM when
- The value you want to add already exists in one physical column.
- You want the simplest and fastest expression.
- Examples:
Sales[Amount],GL[Debit],Inventory[OnHandQty].
Total Net Amount :=
SUM(OrderLines[NetAmount])Use SUMX when
- The amount must be calculated row by row first.
- The expression uses more than one column from the same row.
- Examples: quantity × price, amount × exchange rate, revenue - cost, weighted scoring.
Total Net Amount :=
SUMX(
OrderLines,
OrderLines[Qty] * OrderLines[UnitPrice] * (1 - OrderLines[DiscountPct])
)Real-life examples of X functions
SUMX: invoice lines, variable pricing, tax, margin, freight.AVERAGEX: average customer profitability per customer.MAXX/MINX: highest or lowest row-based computed value.CONCATENATEX: combine text from visible rows in a report.
Important nuance
- SUM is not “bad”. If the correct result already exists as a column, SUM is the right tool.
- SUMX is not automatically better. It is needed only when the calculation must be evaluated for each row.
- If you can model a reusable helper column correctly, sometimes
SUMbecomes enough.
X function.
If it sounds like “just add the values already stored in this column”, plain SUM is enough.