Your first DAX measure: SUMX explained for beginners
DAX has 200+ functions. You need maybe 20. SUMX is the first one to understand deeply — once you get it, half of DAX clicks.
If you have built one Power BI report and are now staring at the Formula bar wondering where to start with DAX, this post is for you. We are going to learn one function — SUMX — properly, because if you understand it, you will understand the entire row-context concept that powers DAX.
The problem SUMX solves
Imagine a Sales table with three columns:
| Product | Quantity | UnitPrice |
|---|---|---|
| Power BI Course | 3 | 500 |
| Excel Course | 5 | 200 |
| DAX Course | 2 | 700 |
You want total revenue. Total revenue is Quantity × UnitPrice summed for every row: 1500 + 1000 + 1400 = 3900.
In Excel you would add a helper column called Revenue, type =B2*C2, drag it down, then SUM. Three actions.
In DAX, you do not add columns. You write one measure:
Total Revenue = SUMX(Sales, Sales[Quantity] * Sales[UnitPrice])
That is the entire calculation. No helper column. No drag. Refreshable.
Reading the formula
SUMX takes two arguments:
- A table to iterate over (here:
Sales). - An expression to evaluate for each row (here:
Quantity * UnitPrice).
SUMX walks the table row by row. For each row it computes the expression. At the end it adds up all the results.
Row 1: 3 × 500 = 1500.
Row 2: 5 × 200 = 1000.
Row 3: 2 × 700 = 1400.
Total: 3900.
Why not just SUM?
This is the question that confuses people for weeks. SUM(Sales[Quantity]) works — it just sums one column. SUM(Sales[Quantity] * Sales[UnitPrice]) does NOT work — DAX has no idea what column to sum because Quantity * UnitPrice is not a column, it is a calculated expression per row.
SUM is for columns. SUMX is for expressions across rows.
The general pattern
Once you see SUMX, you start seeing its siblings everywhere:
AVERAGEX— average of an expression across rows.MINX,MAXX— min and max of an expression.COUNTX— count of rows where the expression is not blank.
The X suffix in DAX always means "iterate row by row". Once you internalise the X family, you can express almost any per-row calculation.
Try it
Open Power BI Desktop. Create a tiny table with Product, Quantity, UnitPrice. Click New measure in the Modeling ribbon. Type:
Total Revenue = SUMX(Sales, Sales[Quantity] * Sales[UnitPrice])
Drop it on a card. You should see 3900. Now change one of the quantities in the table — the card updates instantly. You just wrote your first DAX measure.
From here, our paid courses go into CALCULATE, filter context, and time intelligence. But SUMX is the foundation. If you understand it, everything else in DAX is variations on the same theme: iterate, evaluate, aggregate.