- Access exercises (91)
- C# exercises (79)
- Excel exercises (278)
- Power Apps exercises (13)
- Power Automate exercises (18)
- Power BI exercises (139)
- Power Platform exercises (157)
- Python exercises (28)
- Report Builder exercises (141)
- SQL exercises (198)
- SSAS exercises (51)
- SSIS exercises (46)
- SSRS exercises (99)
- VBA exercises (85)
- Visual Basic exercises (46)
POWER BI EXERCISES▼
POWER BI EXERCISES▼
- Basic reports (10)
- Data sources (2)
- Query editor (8)
- Filtering data (9)
- Drill-through (1)
- Charts (10)
- Matrices (1)
- Basic maps (6)
- Calculated columns (8)
- Roles and security (1)
- Drill-through and bookmarks (3)
- Report themes (2)
- Power BI mobile (1)
- Advanced tables (3)
- Conditional formatting (5)
- Analytics (2)
- Decomposition tree (1)
- Other visuals (1)
- Tooltips (2)
- Bookmarks (4)
- Quick measures (3)
- Dynamic display (1)
- Custom visuals (3)
- Advanced data sources (4)
- Basic parameters (1)
- Column transforms (2)
- Combining queries (2)
- Manipulation transforms (1)
- Normalising tables (2)
- Simple parameters (1)
- Dropdown parameters (1)
- Stored procedures (1)
- Dynamic connections (2)
- Custom functions (3)
- APIs (3)
- Power BI Templates (1)
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 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.