Order Lines
Green row = current SUMX iteration
Order
Product
Qty
Unit Price
Discount
Net Amount
Result 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 matterUse 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.
Rule of thumb: if your business question sounds like
“for each row, calculate something, then total it”, you probably need an
X function.
If it sounds like “just add the values already stored in this column”, plain SUM is enough.