Row by row with SUMX
There is no amount column in Sales: each line has a Quantity and a Unit Price. The amount of a line is their product, and the sales amount is the sum of those products.
SUMX(Sales, expression) walks the visible rows of Sales one by one. While it is on a row, the row context lets you read that row's Sales[Quantity] and Sales[Unit Price].
Your task
Write a measure named Sales Amount: quantity times unit price, added up over all sales lines.
The matrix updates as you type. When it looks right, check it: every cell and every total is compared with the expected result.
About this exercise
You practise iterators and row context with SUMX. The exercise runs on a small bike-shop model with a Sales fact table and Product, Customer and Date dimensions, the same star schema in every lesson.
Your measure, Sales Amount, fills a Power BI-style matrix grouped by Product[Category] and Date[Year]. As in a real report, each cell evaluates the measure in its own filter context, and the subtotals and the grand total are evaluated again in theirs rather than added up. When you check your answer, every cell is compared with the expected value, wrong cells are marked, and the hint is about the mistake you made.
Last updated 10 November 2026
Solution, expected result and common mistakes
Worked solution
Sales Amount = SUMX(Sales, Sales[Quantity] * Sales[Unit Price])Iterators such as SUMX create a row context. Inside it, a column reference means "the value on the current row".
The expected result
| Year | |||
|---|---|---|---|
| Category | 2024 | 2025 | Total |
| Accessories | 14,055.15 | 13,515.75 | 27,570.90 |
| Bikes | 102,364.50 | 107,241.50 | 209,606.00 |
| Clothing | 11,238.50 | 8,979.05 | 20,217.55 |
| Total | 127,658.15 | 129,736.30 | 257,394.45 |
Common mistakes
Sales Amount = SUM(Sales[Quantity]) * SUM(Sales[Unit Price])That multiplies two totals: all units times the sum of all prices. Multiply on each line first, then add up the lines with SUMX.
Sales Amount = SUM(Sales[Unit Price])That adds up the price of each line once, whatever the quantity. Multiply by Sales[Quantity] inside SUMX.
Sales Amount = SUM(Sales[Quantity]) * AVERAGE(Sales[Unit Price])An average price times units is close, but not exact: expensive lines with big quantities get the wrong weight. Compute each line's amount with SUMX.
Hints
- SUM only takes a column. To add up an expression, you need the X version: SUMX(Table, Expression).
- SUMX(Sales, Sales[Quantity] * ...) — what goes after the *?
Measure
| Year | |||
|---|---|---|---|
| Category | 2024 | 2025 | Total |
| Accessories | 14,055.15 | 13,515.75 | 27,570.90 |
| Bikes | 102,364.50 | 107,241.50 | 209,606.00 |
| Clothing | 11,238.50 | 8,979.05 | 20,217.55 |
| Total | 127,658.15 | 129,736.30 | 257,394.45 |
Start typing to see your numbers.