Practice — Medium · Extending the Family
Skills focus. Writing new measures without a recipe — composition, iterators,
and reading a measure table like an analyst.
Ungraded. Start from Mild's finished family. The tasks name the business question; you choose the DAX.
Tasks
- Basket size. Operations asks: "how many units does a typical order
contain?" Build
Avg Units per Orderfrom measures you already have. Check: 3.033. - Average line profit. Finance wants the average profit per order line: per row, quantity × (discounted price − unit cost), averaged across all lines. This needs an iterator and RELATED. Check: your value times 165,042 should land within rounding of Gross Profit — write down why that identity must hold.
- The margin table. Build a table visual: Category · Total Revenue · Gross Profit · Gross Margin %. Sort it three times — by revenue, by profit, by margin — and write one sentence per sort naming the leader.
- The rankings disagree. Revenue crowns Furniture; margin crowns Decor. Where does Gross Profit (the dollars, not the percent) crown? Look before you reason, then explain why profit-dollars lands where it does using the other two columns.
Hint — task 2's shape
AVERAGEX ( Sales, Sales[Quantity] * ( Sales[UnitPrice] * ( 1 - Sales[DiscountPct] )
- RELATED ( Products[UnitCost] ) ) ) — the iterator supplies row context; RELATED
crosses to the product's cost inside it.
Reflection
- Task 1 was one DIVIDE of existing measures; task 2 needed a fresh iterator. What property of the question decided which kind of construction was required?
- Three sorts, three different "best" categories. When the VP asks "which category is doing best?", what is the honest first response?