7

Now do it in Power BI Desktop

Iterators and row context: Power BI Desktop exercise

Calculate row by row, then summarize: the patterns behind most real measures. You practised this in the browser; now do it in your own copy of Power BI Desktop (free from Microsoft), on the same data, and check your numbers below.

1. Get the data

In Power BI Desktop: Home → Get data → Text/CSV, pick each file, then Load. Check that numbers came in as numbers and dates as dates (Table view, column header icons).

2. The tasks

  1. 1. Revenue from units and price

    Multiply Units Sold by Sale Price on every row and add it up.

  2. 2. Average per country

    What does an average country sell? (Iterate the countries, not the rows.)

  3. 3. Best single sale per product

    The largest Sales value of any row, per product.

3. Check your numbers

Try every task first. Then open each answer: the numbers below come from the same data, so yours should match exactly.

1. Revenue from units and price
Revenue = SUMX(financials, financials[Units Sold] * financials[Sale Price])

Result: 127,931,598.5

2. Average per country
Avg Country Sales = AVERAGEX(VALUES(financials[Country]), CALCULATE(SUM(financials[Sales])))

Result: 23,745,270.05

3. Best single sale per product
Biggest Sale = MAXX(financials, financials[Sales])
ProductBiggest Sale
Amarilla1,017,338
Carretera978,236
Montana1,038,082.5
Paseo1,159,200
Velo1,035,625.5
VTT986,811
Total1,159,200

The lessons behind this exercise