EXERCISE TOPIC▼
POWER BI EXERCISES▼
POWER BI EXERCISES▼
- Basic reports (10)
- Data sources (2)
- Query editor (8)
- Multiple tables (1)
- Filtering data (9)
- Drill-through filtering (1)
- Bookmarks (4)
- Charts (10)
- Other types of visualisation (1)
- Overview of maps (6)
- Calculated columns (7)
- Introduction to DAX (3)
- Creating measures in DAX (1)
- Calendars (2)
- Date functions (2)
- Roles and security (1)
- Advanced data models (4)
- Drill-through and bookmarks (3)
- Custom visuals (3)
- Parameters (5)
- Quick measures (3)
- Report themes (2)
- Power BI mobile (1)
- Power BI Templates (1)
- Tooltips (2)
Power BI | Query editor exercise | Unpivoting data and changing the data source
This exercise is provided to allow potential course delegates to choose the correct Wise Owl Microsoft training course, and may not be reproduced in whole or in part in any format without the prior written consent of Wise Owl.
You can learn how to do this exercise if you attend one of more of the courses listed below!
Software ==> | Power BI (92 exercises) |
Version ==> | Latest update |
Topic ==> | Query editor (8 exercises) |
Level ==> | Harder than average |
Classroom ==> | Introduction to Power BI / Fast track Power BI and DAX / Fast track Power BI |
Online ==> | Introduction to Power BI / Fast track Power BI and DAX / Fast track Power BI |
You need a minimum screen resolution of about 700 pixels width to see our exercises. This is because they contain diagrams and tables which would not be viewable easily on a mobile phone or small laptop. Please use a larger tablet, notebook or desktop computer, or change your screen resolution settings.
This exercise covers unpivoting data, changing data sources and more besides! To begin with, create a new report and load the data in the First Half.xlsx workbook.
User Query Editor to tidy up this data so that you have something like this:

You'll need to remove the top row, then make the new top row into the row headers.
Choose the following option to unpivot the monthly data:

Choose to unpivot the months of data.
After a bit of renaming, you should have this table in Power BI:

The start of the table of unpivoted data.
Use this to create a chart showing value by month:

The problem is that we want to sort the months correctly, but to do that you'll need to assign numbers to them.
Go back to Query Editor and add a conditional column:

The option to add a conditional column, returning the correct month number for each row.
This should give you something like this:

After painstakingly typing in the 6 possible conditions and results, you should have a column turning a month name into a number.
You might have found it easier to do a couple of conditions then edit the M formula for this step to add the other four (it's certainly worth having a look at it to see how easy it is to understand and amend).
You can now choose to sort your month names by number:

Choose this option to sort your month names correctly.
After checking your chart is sorting by the correct column, you should now have this!

The same chart, but with the correct sort order.
Oh dear - Wise Owl can only apologise. The exercise asked you to link to the wrong file. Change your M to refer to the file called Second half.xlsx (you'll need to go down your query steps making lots of editing changes to resolve errors), then check your chart still works:

After a lot of retyping in your query step formulae you should eventually get this chart!
Save your report as The knees of a bee, then close it down.