Level 2 project: data from several sources

A retailer with several branches wants one shared report. The data comes from different exports and an Excel plan. In Power Query you bring it into the shape Power BI needs.

You need: Append queries, Merge queries, Group by, Unpivot and Conditional column.

The situation

Every branch exports its orders from its own till system, each with a slightly different layout. Which branch belongs to which region is in a small list kept by the sales manager. Finance maintains the plan in Excel, one column per month. So far someone copies everything together by hand. With Power Query this happens on every refresh by itself.

The project

Part 1: append the exports

Task Part 1: the Leeds and Bristol branches send separate exports. Append Bristol below Leeds.

ABCDEFG
1 OrderID Branch Amount OrderID Amount Branch
2 501 Leeds 1798 601 1145 Bristol
3 502 Leeds 229 602 59.7 Bristol
4 503 Leeds 596 603 899 Bristol

This exercise is part of Premium.

Premium unlocks every exercise in every lesson, unlimited practice with fresh tasks and the final test with certificate.

See Premium Already Premium? Log in

Part 2: add the region

Task Part 2: the report should be able to filter by region. Merge Sales with Branches on Branch and expand Region.

ABCDEF
1 OrderID Branch Amount Branch Region
2 702 Leeds 1798 Leeds North
3 703 Leeds 229 Bristol West
4 704 Bristol 596 York North
5 705 Bristol 1145
6 706 York 899

This exercise is part of Premium.

Premium unlocks every exercise in every lesson, unlimited practice with fresh tasks and the final test with certificate.

See Premium Already Premium? Log in

Part 3: overview per region

Task Part 3: a small table is enough for the monthly email to the regional managers. Group by Region and sum Amount into the column Sales.

ABC
1 Region Branch Amount
2 North Leeds 1798
3 North York 596
4 West Bristol 1145
5 North Leeds 229
6 West Bristol 899
7 West Bath 3596

This exercise is part of Premium.

Premium unlocks every exercise in every lesson, unlimited practice with fresh tasks and the final test with certificate.

See Premium Already Premium? Log in

Part 4: the plan in the long shape

Task Part 4: so the report can compare plan and actual, the plan needs one row per region and month. Unpivot every column except Region, then add a conditional column Quarter: if Attribute equals Mar, then Quarter end, else leave it empty (Else without a value).

ABCD
1 Region Jan Feb Mar
2 North 20000 19500 22000
3 West 15000 14200 16800

This exercise is part of Premium.

Premium unlocks every exercise in every lesson, unlimited practice with fresh tasks and the final test with certificate.

See Premium Already Premium? Log in

Rebuild it in real Power BI

  1. Load the exports with Get data, Folder if they all sit in one folder; otherwise load them one by one and combine them with Append Queries as New.
  2. Load the branch list and add the region with Merge Queries, or bring it into the model as a table of its own with a relationship (level 3).
  3. Load the plan, Unpivot Other Columns, rename Attribute to Month and Value to Plan, set the data types.
  4. Close & Apply. In the report, a matrix then compares sales and plan per region.

What you learned in level 2

  • Cleaning data: Trim, Remove Duplicates, Replace Values (lesson).
  • Splitting columns and setting data types correctly.
  • Merging and appending queries.
  • Unpivoting and grouping.
  • Conditional columns.

Level 3, the data model, comes next: Star schema. The overview is on the course page.

Write to us

Choose language

Select your preferred language