DAX function
SUMX — DAX function reference
Sum a per-row expression.
Syntax
dax
SUMX(<table>, <expression>)
Examples
dax
SUMX(Sales, Sales[Qty] * Sales[Price])
→ A number
RELATED pulls the per-unit cost from the Product table into each Sales row before SUMX multiplies and totals.
dax
SUMX(Sales, Sales[Qty] * RELATED(Product[UnitCost]))
→ Total cost of goods sold
dax
SUMX(FILTER(Sales, Sales[Region] = "West"), Sales[Amount] * (1 - Sales[DiscountPct]))
→ Net West-region revenue after discount
Common mistakes & gotchas
- Use the X version when the value you need does not exist as a single column.
- SUMX creates row context for each row of its table argument; any measure or CALCULATE-wrapped expression inside triggers context transition per row.
- Passing an entire fact table like SUMX(Sales, …) can be expensive on large models — filter the table argument down first rather than filtering the result afterward.
Related DAX functions
From Aggregations