Reading across a relationship
The cost of a product lives in Product[Standard Cost], one row per product. Sales lines only store a ProductKey.
Inside SUMX(Sales, ...) you have a row context on Sales. RELATED(Product[Standard Cost]) follows the relationship from that sales line to its product and returns the cost. It works from the many side (*) to the one side (1).
Your task
Write a measure named Total Cost: for each sales line, quantity times the product's standard cost, added up.
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 related inside an iterator with RELATED. 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, Total Cost, fills a Power BI-style matrix grouped by Customer[Country] 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.
Measures that already exist in the model: Sales Amount. Reference them in square brackets, for example [Sales Amount].
Last updated 10 November 2026
Solution, expected result and common mistakes
Worked solution
Total Cost = SUMX(Sales, Sales[Quantity] * RELATED(Product[Standard Cost]))RELATED reads one value from the one side of a relationship, for the row you are iterating.
The expected result
| Year | |||
|---|---|---|---|
| Country | 2024 | 2025 | Total |
| France | 15,650.00 | 11,552.50 | 27,202.50 |
| Germany | 18,421.50 | 26,710.50 | 45,132.00 |
| Netherlands | 11,295.00 | 14,769.00 | 26,064.00 |
| United Kingdom | 18,386.00 | 12,804.00 | 31,190.00 |
| Total | 63,752.50 | 65,836.00 | 129,588.50 |
Common mistakes
Total Cost = SUM(Product[Standard Cost])That adds up the cost list once per product. Customers and years do not filter Product, so every cell shows the same number. Iterate Sales and read the cost with RELATED.
Total Cost = SUMX(Sales, RELATED(Product[Standard Cost]))Close: this counts each line's cost once. A line with 3 units costs three times as much. Multiply by Sales[Quantity].
Total Cost = SUM(Sales[Quantity]) * SUM(Product[Standard Cost])That multiplies two unrelated totals. Do the multiplication per sales line with SUMX(Sales, ...).
Hints
- Start like Sales Amount: SUMX(Sales, Sales[Quantity] * ...).
- Sales[...] can't see Product columns directly. Wrap the cost in RELATED( ).
Measure
| Year | |||
|---|---|---|---|
| Country | 2024 | 2025 | Total |
| France | 15,650.00 | 11,552.50 | 27,202.50 |
| Germany | 18,421.50 | 26,710.50 | 45,132.00 |
| Netherlands | 11,295.00 | 14,769.00 | 26,064.00 |
| United Kingdom | 18,386.00 | 12,804.00 | 31,190.00 |
| Total | 63,752.50 | 65,836.00 | 129,588.50 |
Start typing to see your numbers.