4

Now do it in Power BI Desktop

Power Query: Power BI Desktop exercise

Shape the data in the real Power Query Editor (Home → Transform data), then check the result with a measure. 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. Remove what you don't need

    In Power Query, remove the COGS column, then Close & Apply. Check that Profit still adds up to the same total.

  2. 2. Group by country

    Make a reference of the query and use Group By on Country with the sum of Sales. Compare each country with this table.

  3. 3. Keep one segment

    In another reference, filter Segment to Government only. How many rows are left?

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. Remove what you don't need
Total Profit = SUM(financials[Profit])
  • Select the COGS column → Home → Remove Columns.

Result: 16,893,702.25

2. Group by country
Total Sales = SUM(financials[Sales])
  • Right-click the query → Reference.
  • Home → Group By → Country, new column Total Sales = Sum of Sales.
CountryTotal Sales
Canada24,887,654.88
France24,354,172.29
Germany23,505,340.82
Mexico20,949,352.11
United States of America25,029,830.16
Total118,726,350.26
3. Keep one segment
Government Rows = CALCULATE(COUNTROWS(financials), financials[Segment] = "Government")
  • Segment column filter → only Government.

Result: 300

The lessons behind this exercise