WISE OWL EXERCISES
POWER BI EXERCISES
- PowerPivot data models (7)
- Pivot tables using PowerPivot (2)
- Using Excel tables (3)
- Using other data sources (1)
- Transforming data (Power Query) (7)
- Calculated columns (7)
- Measures (2)
- The CALCULATE function (15)
- More advanced DAX functions (5)
- Calendars (1)
- Date functions (10)
- Hierarchies (2)
- KPIs (5)
- Power View (4)
- Power BI Desktop overview (3)
- Power BI Desktop maps (1)
PowerPivot | Transforming data (Power Query) exercise | Change data types of columns in world population table
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 on the relevant Wise Owl classroom training course (sadly for the moment only in the UK).
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.
Open up the workbook called Tables in the above folder, and have a look at the Populations worksheet:
We'll import this data into an Excel worksheet, tweaking it along the way.
Now close this workbook down, and create a new workbook.
You could use try loading the source data from the original Wikipedia page at http://bit.ly/14wM1IU if you have an Internet connection, although this may not be in the same format by the time you do the exercise.
In Power Query, choose to create a query based on this workbook:
The option you'll need to choose. Make sure you choose the table called Populations, not the one with the much longer name.
Do the following things to make this table easier to read:
- Tell Power Query to use the first row as column headings.
- Delete the Source column (we don't need it).
- Change the data type of the Date column to Date.
- Change the data type of the Population column to Whole Number.
- Shorten the name of the Country column.
You should now have something like this:
It's looking a bit more manageable!
To use this data in Excel, you'll have to turn the percentage columns into numbers. Try doing this, and you'll see this doesn't work:
The % sign is messing things up!
Undo this (except it's not undoing, it's deleting the last step of the query), and replace values in the % of world population column to replace all % symbols with spaces. You should now be able to change the data type to Decimal Number.
Load this data into your (presumably empty) PowerPivot data model:
We've changed the format of the date to make it look tidier. It's a shame we didn't make the Rank column a number too!
Change the data type of the Rank column in PowerPivot, then save your workbook as Populations and close it down.