Business Intelligence with Power BI

L05 · DAX I: Measures

Practice — Mild · Family Rehearsal

Skills focus. Writing the lesson's measure family with the answer key open — muscle memory for A05.

Ungraded. Start from your A04 star. Every checkpoint is a verified figure.

Tasks

  1. Calculated column on sales: Line Revenue = Sales[Quantity] * Sales[UnitPrice] * (1 - Sales[DiscountPct]). Checkpoint: a card summing it reads $66.81M.
  2. Explicit measure: Total Revenue = SUM ( Sales[Line Revenue] ). Format as currency on the measure. Replace the implicit card with it.
  3. Rewrite it the column-free way with SUMX (keep both temporarily; compare: identical $66,813,563.97). Delete one — your choice, but know why you chose.
  4. Total Cost = SUMX ( Sales, Sales[Quantity] * RELATED ( Products[UnitCost] ) ). Checkpoint: $28,099,192.18.
  5. Compose: Gross Profit = [Total Revenue] - [Total Cost] and Gross Margin % = DIVIDE ( [Gross Profit], [Total Revenue] ), percent format. Checkpoints: $38,714,371.79 · 57.94%.
  6. Order Count = DISTINCTCOUNT ( Sales[OrderID] ) and Average Order Value = DIVIDE ( [Total Revenue], [Order Count] ). Checkpoints: 85,538 · $781.10.
  7. Drop [Gross Margin %] into a table against Category and read the five values. Checkpoint: they differ — one definition, five filter contexts. Which category surprises you? Hold that thought for Medium.
Hint — RELATED errors with "cannot find table"

Either the sales→products relationship is missing (Model view first), or RELATED is written outside row context — it must sit inside the SUMX's expression, not wrap the whole thing.

Reflection

  • Steps 2 and 3 produced identical numbers by different routes. Which would you rather maintain in a model refreshed nightly for three years, and why?
  • Step 7's five margins came from one formula. Where did the "five-ness" come from?