3. Excel Power Query
Welcome to ‘Excel Power Query Secrets: How to Cut Data Prep Time by 75%’
Entire course available on Udemy.com
https://goo.gl/9NADTc
Special discount using coupon code: PQUERY10
4. 5 Reasons to Love Power Query
1. Excel based
2. Improves existing processes
3. No coding required
4. Handles just about any data
5. It keeps getting better
5. Alternatives to Power Query
1. Waiting for the Technology Dept
2. Microsoft Access
3. Visual Basic for Excel
6. Power Query vs Power BI
Excel
• Power
Query
Power BI
• Cloud
version
• Desktop
version
Power Query
data engine
7. Power Query vs Power BI
Visualizations
and
Dashboards
Data Cleansing
using
Spreadsheets
Power BI
Power Query
8. Power Query Ribbon
Ribbon
Data Completed
Queries
This course will teach you how to use the Power Query
ribbons to automate and customize your data
transformations.
9. Power Query Editor
Here is a data set I call ‘DogCatSquirrel’ that helps with training.
It’s meant to be simple and lighthearted but provide enough details so
we can ‘dig into it’ and see how the Editor can transform the data.
This will lead us to more complex examples, geared for Finance and
Accounting, in the remainder of the course.
10. Power Query Editor
1. First, I place my cursor inside the data set
2. Press ‘Excel Data From Table’ which creates a data table that will be imported to
Power Query Editor
3. Press ‘OK’ and the Power Query Editor opens
11. Power Query Editor
Notice that Power Query
• imports the data into the ‘Editor’
• assigns a ‘starting’ name to it (in this case it’s ‘Table 7’)
• applies two steps (Source and Changed Type)
• and shows the Power Query Editor ribbons which are
• Home Transform Add Column View
From here I can make a variety of data transformations like done manually regular Excel
12. Power Query Editor
Just like with the Power Query Ribbon, let get an overview of the Power Query Editor
There are five separate sections
1. The different ribbons
2. The ‘Applied Steps’ that transform your data. These are listed in the order that they are performed
3. The ‘Results’ section which shows how your data looks as each transformation is performed
4. There is a formula language behind these transformations called ‘M’. You don’t need to learn it, but the ‘Formula Bar’ shows more detail on how each
step changes your data
5. The ‘Navigator’ section is used to move between different queries in your currently open Excel workbook. This is convenient to zip around as you get
more comfortable.
13. Power Query Editor
A key point is that these ribbons replicate all the things you would do manually when transforming your data in
Excel. How many times have you received a data file and you say ‘Oh, this is not in the format I need or the data
needs to be grouped differently’.
The ‘Home’ ribbon has a lot of features. Let’s go thru them and see some examples of their use along the way
• ‘Close and Load’ loads your edited transformation back into Excel and puts the transformed data into either
an Excel table on a worksheet or it creates a ‘connection’ which you can reference in other queries.
• ‘Properties’ lets me change the name of the query. I will change it to ‘DogCatSquirrel’. I can also put in note
to remind myself about how the query was designed. See how it changes the name on the right side?
• Advanced Editor lets me see the ‘M’ code sitting behind the transformations.
• ‘Manage’ lets me Delete, Duplicate or Reference this query. I will cover each of these in a later lesson
14. Power Query Editor
• In the ‘Manage Columns’ section
• ‘Choose Columns’ lets me choose columns to keep and
• ‘Remove Columns’ lets me remove the selected column or all other columns.
They are two ways to achieve the same result.
15. Power Query Editor
• Likewise, in the ‘Reduce Rows’ section you can
• ‘Keep Rows’ provides different options such as keep top or bottom rows plus a
few other options and
• ‘Remove Rows’ lets me remove top, bottom, duplicate, blank and other types of
rows. Like with Manage Columns, they are two ways to achieve the same result.
16. Power Query Editor
• Sort lets you soft ‘A – Z’ or ‘Z – A’ base on alpha numeric It’s also possible to sort on
multiple columns. For instance, I can sort ‘Animal’ ‘A – Z’ and Weight in a descending
order (high to low). Notice that each time I perform a transformation, it is added to
the ‘Applied Steps’ section on the right.
• If I perform a step and then decide it’s not needed, I can simply delete it.
17. Power Query Editor
• Each column has a designated data type. The three most common used by Finance and Accounting are
‘text’, ‘decimal number’ and ‘date’.
• It’s very important that you’re column be set to the correct data type. Otherwise, your transformations
may not work as expected. For instance, if the ‘Weight’ column had been set to ‘text’, the Group By
function would not have summed up the values.
• Likewise, there are a lot of nice transformations that can be done on date values if you have that type of
data and set the column correctly.
18. Power Query Editor
• ‘Use First Row as Headers’ lets you update column names based on the names in your source data.
• ‘Replace Values’ lets you search and replace column values. For example, I will look for ‘Cat’ and replace
with ‘Lion’ (show example). Again, the benefit is that it can be done on thousands of records very quickly
and be part of the data transformation sequence shown in ‘Applied Steps’.
19. Power Query Editor
Wow. We have covered a lot of data transformation options in the Power Query Editor and are only one the
first of four editor ribbons! Microsoft has done an excellent job putting in so many capabilities.
21. Installation and Updates
In this lecture I show how to install Power Query for Excel and how to make updates when new versions are released.
One key point - - Power Query comes pre-installed on Excel 2016. You only need to do your own installation if you’re using Excel
2013 or Excel 2010.
23. Installation and Updates
Download site: https://goo.gl/QWnKYV
I usually expand the ‘Details’ section to see the version and ‘Date Published’. Select the
‘Download’ button . . .
24. Installation and Updates
Download site: https://goo.gl/QWnKYV
And another windows lets you select the files. You select either the 32-bit or 64-bit .msi file. This refers to the version of Excel
you’re using. Most people are using 64-bit these days, but it’s good to check your version.
27. Installation and Updates
Download site: https://goo.gl/QWnKYV
Select ‘About Excel’ and this opens a window that shows your version. It’s listed in the top right corner
28. Installation and Updates
Download site: https://goo.gl/QWnKYV
I see that I’m using the 64-bit version of Excel and select the 64-bit .msi file and press ‘Next’
29. Installation and Updates
Download site: https://goo.gl/QWnKYV
Now go back to the download file, double-click and press ‘Run’. This starts the installation process.
30. Installation and Updates
There are several setup windows that appear. Press ‘Next’ . . .
Download site: https://goo.gl/QWnKYV
31. Installation and Updates
Accept the terms of the License Agreement and press ‘Next’ . . .
Download site: https://goo.gl/QWnKYV
32. Installation and Updates
I always select the default destination folder and press ‘Next’ . . .
Download site: https://goo.gl/QWnKYV
39. Installation and Updates
Sometimes Excel will unexpectedly uncheck the Power Query ribbon. If the ribbon disappears
from your toolbar, do this to make sure it’s checked, or active, in the ‘COM Add-Ins’ window.
40. Installation and Updates
In this lecture I showed you how to install Power Query for Excel and how to make updates when
new versions are released by Microsoft.
41. Push Button (Level 1)
Power Query Editor Functions
Import Excel file
Remove Top Rows
Use First Row as Header
Remove Columns
Change Type
Split Columns by Delimiter
Rename Columns
Close & Load
Here are some of the push-button functions we’ll use in this lecture
42. Formulas (Level 2)
Power Query Editor Functions
Merge Columns
Conditional Columns
Reorder Columns
Rename steps
Move steps
View ‘M’ Code
Sort Rows
Filter Rows
Here are the Power Query Editor functions we’ll use in this lecture. Many of them are formula
based and require you to enter values to define them properly. These will greatly extend your
capabilities and make you a Power Query superstar.
43. Multi-Query (Level 3)
Power Query Editor Functions
Rename query
Reference
Group-By
Duplicate
Refresh
Merge
Here are the Power Query Editor functions we’ll use in this lecture. Many of them are formula
based and require you to enter values to define them properly. These will greatly extend your
capabilities and make you a Power Query superstar.
44. Multi-Query (Level 3)
I create separate PQ imports from Excel and csv files that link to general ledgers descriptions and
product masters. You have many possibilities and are limited only by your imagination.
Company Description
10 USA
20 Canada
Department Description
200 Finance
400 Operations
Account Description
69500 Travel
71500 Rent
72500 Salaries
Power Query
45. Excel Power Query
Learn everything at ‘Excel Power Query Secrets: How to Cut Data Prep Time by 75%’
Entire course available on Udemy.com
https://goo.gl/9NADTc
Special discount using coupon code: PQUERY10