An Introduction to PowerQuery

Today we had our first introduction to Power BI. Although on the surface it can be quite intimidating to learn a new piece of software, most of the same principles of data preparation you would find in other pieces of software are included here (and a few unique features of its own). A couple of features were new to me and I thought I would document them below.

Power BI integrates data preparation and visualisation into one application, so one can find PowerQuery (prep) and Power BI Desktop (visualisation) under the same roof. Once you import a data source it will display in a preview panel in tabulated form. In order to keep track of the steps taken in cleaning and preparing your data, a sidebar will keep track of your progress and should look something like below:

If you make a change to your dataset, it will be reflected in this pane for you to document and refer to if you need. At any stage, if you click on a step, it will show you how your data looks at that particular stage in the preparation process. A very important disclaimer is that if you delete a step, you cannot reverse that deletion, so it important to be vigilant about the steps taken when manipulating your data.

You can also make use of the advanced editor feature which will keep track of your manipulation in text form in a language called M. It should look something like this (for a data set I imported from Rotten Tomatoes, https://editorial.rottentomatoes.com/guide/best-netflix-movies-to-watch-right-now/):

It can be useful when running diagnostics to understand why something has gone wrong, or to manually manipulate your data if you would prefer to do so in a console environment rather than use a graphical user interface (GUI). After shaping this dataset I ended up with the following query:

After you have finished preparing and shaping the data to your liking, you can save your query as part of a Power BI file. By switching over to the Power BI Desktop window in your taskbar, you can now use that data for visualisation (as I have below).

Author:
Kealan Daly
Powered by The Information Lab
1st Floor, 25 Watling Street, London, EC4M 9BR
Subscribe
to our Newsletter
Get the lastest news about The Data School and application tips
Subscribe now
© 2024 The Information Lab