All DAX Functions

SUM vs SUMX: Aggregators vs Iterators Explained

Column-level aggregation versus row-by-row iterators.

On this page

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.

Syntax

SUM
SUM(<column>)
SUMX
SUMX(<table>, <expression>)
  • SUM(<column>): Requires a single column reference only.
  • SUMX(<table>, <expression>): Table name first, then the row-by-row math equation.

Example & Dataset

A billing table named SalesTransactions:

Sample Data Table: SalesTransactions

TransactionIDProductQuantityUnitPrice
T_01Desk2200
T_02Chair550
T_03Lamp1020

The DAX Code

You cannot use SUM(SalesTransactions[Quantity] * SalesTransactions[UnitPrice])—SUM will throw a syntax error. Use SUMX (recommended):

Approach 1: SUMX (Recommended)
Total Revenue (SUMX) =
SUMX(
    SalesTransactions,
    SalesTransactions[Quantity] * SalesTransactions[UnitPrice]
)
Approach 2: SUM on a Calculated Column (Avoid)
// 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.

Expected Output Visual

Output Table Visual

ProductQuantity (SUM)Unit Price (Avg)Total Revenue (SUMX)
Desk2200400 (2 × 200)
Chair550250 (5 × 50)
Lamp1020200 (10 × 20)
Total1790850

Why Did This Output Happen?

SUMX calculated 2×200=400, 5×50=250, and 10×20=200, then summed to $850—without creating extra physical columns.