Uploaded by richfmatos

Power Query the 2022 definitive beginners' guide - UpSlide

advertisement
(https://upslide.net)
Power Query: the 2022
definitive
beginners’
guide
Efficiency Tips (https://upslide.net/category/efficiency-tips/)
How to guides (https://upslide.net/category/how-to-guides/)
Power BI (https://upslide.net/category/features/power-bi/)
Pauline Jouffret
Data Engineer
March 28, 2022
Ever wondered what the Microsoft Office add-in Power Query (https://docs.microsoft.com/enus/power-query/power-query-what-is-power-query) is and how it works? If so, you have come to
the right article.
Pauline, our Power Query expert at UpSlide, will share all her top tips so that you can master the
basics of this software to boost your productivity in Office. If you don’t have time to read our
guide now, bookmark this article and save it for later!
TL;DR
Compare the key differences between Power Query and Power Pivot, Power BI
and Excel VBA.
Download
Power Query and get started. Identify the 4 key elements of the
(https://upslide.net)
Power Query Editor: the main ribbon, queries, data table preview and query
settings.
Shape your first data table with our step-by-step guide. Plus, discover how to
use advanced Power Query skills in this real-world problem scenario.
Table of Contents
[ hide ]
1 What is Power Query? When should I use it?
2 What is the difference between Power Query and Power Pivot?
3 What is the difference between Power Query and Power BI?
4 Is Power Query a good alternative to Excel VBA?
5 Is Microsoft Power Query free? Is there a Power Query for Mac?
6 How to download Power Query
7 How does Power Query work?
8 How to get started with Power Query
9 Advanced Power Query
What is Power Query? When should I use it?
Power Query is a user-friendly and powerful Office 365 add-in that allows you to import, clean
and consolidate data. You’ll want to use Power Query when:
Processing large amounts of data (where Excel is limited to one million rows)
Importing data from different sources (e.g. Excel, CSV, SharePoint, SQL, and Salesforce)
Manipulating, cleaning and combining several tables, files or even folders!
(https://upslide.net)
A key benefit of Power Query is that it doesn’t change the original data source. The outcome is
like a snapshot of reshaped data brought to Excel. Since the source data is not directly imported,
it does not make your Excel file heavier (i.e. it doesn’t slow down your computer!)
In summary, Power Query is a data analysis tool making ETL
(https://en.wikipedia.org/wiki/Extract,_transform,_load) (Extract-Transform-Load) processes more
simple and effective.
(https://upslide.net)
Thanks to Power Query, I can easily flatten tables for my
models.
Pauline Jouffret
Data Engineer
What is the difference between Power Query and Power Pivot?
Power Pivot (https://support.office.com/en-us/article/power-pivot-powerful-data-analysis-anddata-modeling-in-excel-a9c2c6e2-cc49-4976-a7d7-40896795d045) is often associated with
Power Query as it’s also a Microsoft Office add-in that eases data analysis.
However, these tools typically work in tandem, as Power Pivot enables users to create data
models from tables previously cleaned by Power Query. To summarize:
Power Query allows you to automatically consolidate and reprocess files (i.e. the
standardization of reporting processes or consolidation of several files with the same format).
Power Pivot enables you to analyze databases of several million lines by extracting aggregated
information according to the rules set by your business.
What is the difference between Power Query and Power BI?
The interface of the Power BI (https://powerbi.microsoft.com/en-us/) Desktop software allows you
to benefit from three technologies (Power Query, Power Pivot and Power View). With Power BI,
you can do all the steps of the data analysis chain, from extracting data to creating visuals on an
interactive dashboard that you can share and analyze.
> Discover the Power BI to PowerPoint or Word Link (https://www.upslide.net/en/powerbi-topowerpoint/) (https://upslide.net)
Is Power Query a good alternative to Excel VBA?
Power Query can easily replace VBA (Visual Basic for Applications
(https://docs.microsoft.com/en-us/office/vba/library-reference/concepts/getting-started-withvba-in-office)) as it enables you to:
Process your tables simply by clicking on buttons. Plus, no coding skills are needed!
Visualize your operations step-by-step without running a single macro.
Easily edit the order of steps by dragging and dropping! Plus, you can add and delete
unnecessary steps with a simple click.
(see Part 2 – Section3: How to get started with Power Query?)
However, Power Query can’t replace VBA when it comes to interacting with Excel’s interface,
automating processes, generating new files, and sending emails.
Is Microsoft Power Query free? Is there a Power Query for Mac?
1 Yes! Power Query is a free extension of Excel, which is another main benefit of the Office
add-in. (Read the next question to find out how you can get it on your Excel desktop)
2 Yes! Power Query is also compatible with Excel for Mac.
(https://upslide.net)
(https://www.poweredsolutions.co/2019/07/15/power-query-in-excel-for-mac-firstimpressions/)
How to download Power Query
The good news is – you do not need to download Power Query for Excel 2019, 2016 or Office 365.
You just need to click the button named Get Data in the Get & Transform section in the Data tab
for Excel 2016 and beyond.
Please note that when you enter the Power Query interface, you will no longer be able to interact
with Excel. If you need to go back to Excel, you will have to close the Power Query editor.
How to check my Excel version
Go to File > Account > About Excel. Then a window will appear. Read the first two numbers in the
parenthesis. In the below example, the Excel version is 2016.
(https://upslide.net)
How does Power Query work?
In Excel, you only have access to the following functionalities when you click on Queries &
Connections:
Data ribbon: to search for data sources
Queries & Connections pane: to have a quick look at all of the connections (queries) you made.
(https://upslide.net)
Once you launched Power Query, you land on the Power Query Editor which is made up of
four distinct elements:
Main ribbon: to create queries from scratch thanks to its buttons (if you are familiar with the M
language, you can also access the Advanced Editor to tweak them manually).
Queries: to keep track of all connections to data sources and streams.
Data Table preview: to visualize your data result after a specific step.
Query Settings (Applied Steps): to navigate through all the steps you made. Power Query
automatically records all transformations made.
In the two last sections, you will be able to practice a bit thanks to an easy use case (you will need
to get Power Query on Excel first):
In section 3, you will learn how Power Query basically works by transforming a data table.
In section 4, it gets even more interesting as you will discover how to proceed with data from
various sources and merge queries.
How to get started with Power Query
Imagine the following situation:
You are the financial controller of a technology firm selling computers and smartphones. Currently,
you’re operating(https://upslide.net)
in 3 countries: France, UK, and China. Each month, you produce a consolidated
report for your manager, with KPIs such as total revenue, revenue by country or revenue by
product. To do so, each country manager – Dennis, Douglas, and Karen – sends you a file.
Problem: each file lists the sales in the country’s own denomination. It is too time-consuming to
convert them to Euros, and then consolidate them into the final report.
What if you could automate the process and compute your report in a few minutes by only using
Power Query?
Well, with Power Query, you can! Let’s start by preparing your first table.
First, you need data. Download our Power Query example (https://www.upslide.net/wp(https://upslide.net)
content/uploads/Power%20Query%20UpSlide%20-%20Retail%20Analysis.zip)
and save it on your
local server.
DOWNLOAD OUR TEST FOLDER
(HTTPS://WWW.UPSLIDE.NET/WPCONTENT/UPLOADS/POWER%20QUERY%20UPSLIDE%20%20RETAIL%20ANALYSIS.ZIP)
(https://www.upslide.net/wp-content/uploads/Power%20Query%20UpSlide%20%20Retail%20Analysis.zip)
Then, follow these easy steps:
Unzip the file and save it to your local server.
Now open a new worksheet in Excel and go to the Data tab > Get Data > From file > From
Workbook, as shown below.
Go to the path where you saved the unzipped files you just downloaded and select the Excel file
named “Exchange Rates”.
(https://upslide.net)
Click on Transform Data.
Congratulations, you are now connected to the data source “Exchange Rates!”
In order to flatten the data, we are going to apply further steps (see the Queries pane)! You may
notice that some applied steps have already appeared in the Query Settings pane. These are
done automatically.
Now let’s clean the data table:
Remove the top 3 rows, go to Remove rows > Remove top rows and type “3”. You will instantly
see the transformation on the Data table preview as well as in the applied steps (Query Settings).
Get rid of blank rows: Remove rows > Remove blank rows (as shown below).
(https://upslide.net)
Promote your first row as a header: click Use First Row as Headers. As you may have noticed,
Power Query automatically added a step to change the type of some data (the values in the first
column are now formatted as Dates).
Remove blank columns: click Choose columns and uncheck columns 7, 8, 9 and 10.
(https://upslide.net)
Unpivot the columns: Select the “Exchange Rate” column, then in the Transform tab, go to
Unpivot columns > Unpivot Other columns (you can also select the five other columns and select
Unpivot columns).
(https://upslide.net)
Rename the columns: click on the header cells, enter “Date” in the first one, “Currency” in the
second one and “Rate” in the third one.
Apply a filter: just like in Excel, click on the drop-down menu of the “Date” column and select
“Dec-18″.
(https://upslide.net)
In the Home tab, click on Close and Load to load the final table in a new sheet.
Well done! You shaped your first data table.
Advanced Power Query
(Re)imagine the following situation:
Thanks to your Power Query skills, you are now a SENIOR financial controller of the technology
firm. Now, you(https://upslide.net)
have to consolidate the December 2018 data that the country manager sent you.
Problem: each file lists the sales in the country’s own currency. It’s time-consuming to convert
them to Euros, and then consolidate them into the final report.
What if you could automate the process and compute your report in a few minutes using Power
Query?
Now we will show you how to consolidate different data sources and merge them with the table
we prepared in the previous section.
* Please note that you need to complete all steps in the previous section
before starting to manipulate the tables.
Firstly, let’s import the whole folder including the three different source files: If you’re still in Power
Query go to New source > File > Folder.
(If back on Excel, go to Get Data > From Folder)
Select the folder “Sales_201812” you previously downloaded and saved. After that click OK.
(https://upslide.net)
A new window should appear. Then, you need to merge the queries:
Select Combine & Edit in the drop-down menu (bottom of the new window).
Select the example table “Dec-18” (please note that all sheets must be named the same way).
(https://upslide.net)
You can check in the first column that all sources are included (click on the drop-down menu), and
then click OK.
You are now in the Power Query editor. Go to Transform tab > Replace Values.
Now replace“€” with “EUR”.
(https://upslide.net)
Go to Home tab > Merge Queries.
A new window appears:
1 Select “Currency” column.
2 Select the “Exchange Rates” file in drop down menu.
3 Select “Currency” column.
4 Click OK.
(https://upslide.net)
Now, you need to display the exchange rate data that you just retrieved:
1 Select “Exchange Rate” column.
2 Click on the Expand button.
3 Check only “Rate”.
4 Untick “Use original …”.
5 Click OK.
(https://upslide.net)
Congratulations! You just loaded another data source, merged queries and retrieved the
corresponding exchange rate. No more VLOOKUP or INDEX+MATCH!
To finish, we will create a “Unit Price EUR” column to convert all prices to Euros:
Go to Add Column tab > Custom Column.
A new window appears. Let’s write the formula of the Price in Euros:
1 Name it “Unit Price EUR”.
2 Double(https://upslide.net)
click on “Unit Price Local Currency” (or select it and then click on Insert).
3 Type “/”.
4 Double click on “Rate”.
5 Click OK.
Once the column appears, click on its type symbol (just before the name) and select “Decimal
Number”.
(https://upslide.net)
Pauline Jouffret
Pauline is a Data Engineer at UpSlide. After 4+ years as a seasoned Consultant and
Project Lead at our sister company, F31, Pauline now oversees the management and
analysis of data across UpSlide.
6 Responses
Abir Mahmud says:
June 7, 2020 at 5:23 am (https://upslide.net/blog/power-query/#comment-1256)
We have to do the same to generate the “Revenue” column:
How to remove the header row of the 2nd file of sales data?
Reply
Go to Add Column tab > Custom Column. A new window appears. Let’s type the Revenue formula:
1 Name
it “Revenue”.
June 8, 2020 at 2:24 pm (https://upslide.net/blog/power-query/#comment-1257)
Edouard
Ouaknine says:
↪
2 Double click on “Unit Price EUR” (or select it and then click on Insert).
3 Type “*”.
Hi Abir,
To 4remove
the headeronrows
of the second file of sales data in Power Query, go to Home tab > Remove
rows >Double
Removeclick
top rows“Quantity”.
and type “1” if you want to remove the first row only (you can type the number of
header
5 Click
rowsOK.
you want to remove).
Let us know if it helped or if you have any other questions!
Best, 1
Edouard
Reply
Kelly A says:
June 10, 2020 at 1:37 pm (https://upslide.net/blog/power-query/#comment-1258)
Thanks for this great post on Excel Power Query–a perfect resource for those who are just starting to
understand how useful this tool can be. I’ll be saving it for future reference. I also came across another post
that takes this information to the next level, and shows 5 actionable ways to use Power Query in the work
setting. Here’s the link (https://beebole.com/blog/excel-power-query-for-business-intelligence/
(https://beebole.com/blog/excel-power-query-for-business-intelligence/)),
in case it’s useful for anyone else
(https://upslide.net)
reading this post.
Reply
Beatriz Zambrano says:
May 11, 2021 at 2:33 am (https://upslide.net/blog/power-query/#comment-1260)
Thanks a lot. Very useful and very easy to understand. Great post.
Reply
joebee says:
September 21, 2021 at 8:18 am (https://upslide.net/blog/power-query/#comment-1262)
This is just awesome. Just starting to learn PQ and these helpful tips just gives me the grounding to learn PQ.
Thanks
so much.
Reply
BrsSrl says:
April 6, 2022 at 9:21 am (https://upslide.net/blog/power-query/#comment-1263)
Again, change the column type to “Decimal Number”.
that was really helpful. thank you ver much. I can’t imagine any tutorial prepared better than this one to
understand.
To
finish, let’s export it to a new data table in Excel!
Reply
Go
to Home
Leave
a Replytab > Close & Load > Close & Load.
Your email address will not be published. Required fields are marked *
Now you can fully benefit from Excel features to analyze the data, make a pivot table, etc.
Post Comment
Efficiency Tips (https://upslide.net/category/efficiency-tips/)
> See more (https://upslide.net/category/branding-and-design/)
(https://upslide.net)
Branding and Design 5 minutes

How to manage email signatures in Outlook
In today’s digital world, successful businesses must effectively and consistently present
their brand identity across...
(https://upslide.net/blog/how-to-manage-email-signatures-in-outlook/)
Wow!
If you made it to the end, congratulations! You’ve now mastered one of the best Microsoft
Office add-ins, Power Query.
Efficiency Tips 5 minutes

4 effective ways of connecting Power BI to PowerPoint
Moremore
and more
professionals have been adopting Power BI, the Microsoft
To learn
aboutfinancial
Power Query:
software that is...
Power Query Academy Training (https://www.powerquery.training/shop/power-query(https://upslide.net/blog/4-effective-ways-of-connecting-power-bi-to-powerpoint/)
academy/): the #1 resource for courses, patterns and more on Power Query for Power BI &
Excel
Power Query challenges (https://www.excelguru.ca/blog/tag/challenge/) by Ken Puls on
ExcelGuru.ca
Combine Excel Files (https://www.poweredsolutions.co/2019/04/23/combine-or-append-datacombining-excel-files/) with Power Query by Miguel Escobar on Powered Solutions
Advanced Folder Combine (https://powerpivotpro.com/2018/05/powerquerymagic-advancefolder-combine/) blog post
(https://upslide.net)
Efficiency Tips 5 minutes

7 easy ways to reduce your Excel file size
We have all encountered an Excel file that’s too large. The kind that takes minutes...
Find out how UpSlide could help you
and
your teams
(https://upslide.net/blog/reduce-excel-file-size/)
Get a demo
(https://upslide.net)
Solutions
Document (https://upslide.net/solution/documentautomationautomation/?
utm_source=upslidewebsite&utm_content=footer)
Brand (https://upslide.net/solution/brand-compliance/?
complianceutm_source=upslidewebsite&utm_content=footer)
Reporting (https://upslide.net/solution/reportingautomationautomation/?
utm_source=upslidewebsite&utm_content=footer)
(https://www.bcorporation.net/en-us/finda-b-corp/company/pyramid/)
Content (https://upslide.net/solution/contentenablementenablement/?
utm_source=upslidewebsite&utm_content=footer)
Enterprise(https://upslide.net/enterprise-solution/?
solution utm_source=upslidewebsite&utm_content=footer)
PowerPoint(https://upslide.net/powerpoint-automation-tool/?
automationutm_source=upslidewebsite&utm_content=footer)
tool
(https://upslide.net)
Top features
Excel to (https://upslide.net/features/link-excelPowerPointpowerpoint/?
Link
utm_source=upslidewebsite&utm_content=footer)
Content (https://upslide.net/features/shared-library/?
Library utm_source=upslidewebsite&utm_content=footer)
(https://www.g2.com/products/upslide/reviews)
Slide (https://upslide.net/features/slide-check/?
Check utm_source=upslidewebsite&utm_content=footer)
PowerPoint(https://upslide.net/features/formattingFormatting features/?
Features utm_source=upslidewebsite&utm_content=footer)
Power BI (https://upslide.net/features/powerbi-toto
PowerPointpowerpoint/?
utm_source=upslidewebsite&utm_content=footer)
Link
Dynamic (https://upslide.net/features/dynamic-tombstoneTombstonelibrary/?
Library utm_source=upslidewebsite&utm_content=footer)
Charts(https://upslide.net/features/charts/?
utm_source=upslidewebsite&utm_content=footer)
Outlook (https://upslide.net/features/outlook-signatureSignaturemanager/?
Manager utm_source=upslidewebsite&utm_content=footer)
(h (h
tt tt
p p
s: s:
// //
Compare
w w h(
UpSlide
w w (https://upslide.net/the-best-alternative-tott
vsw w templafy/?
p
Templafy
.li .y utm_source=upslidewebsite&utm_content=footer)
s:
n ovs (https://upslide.net/the-best-alternative-to//
UpSlide
kMacabacus
ut macabacus/?
t
e u utm_source=upslidewebsite&utm_content=footer)
di b wit
n. e. ust
Follow
c c e
o o
m m r.c
/c /uterms(https://upslide.net/legal-terms/)
Legal
o s mo
m er (https://upslide.net/wpUser
/
p / Ucontent/uploads/2023/11/DATAinformations
a U pPROTECTION-ACT-new-identity.pdf)
p _ UpSlide. All rights reserved.
©n2022-2023
y/ Sl Sl
3 id id
1 e e
Industries
Investment(https://upslide.net/solution/upslide-forbanking investment-banking/?
utm_source=upslidewebsite&utm_content=footer)
(https://upslide.net/solution/upslide-forAdvisoryadvisory/?
utm_source=upslidewebsite&utm_content=footer)
Private(https://upslide.net/solution/upslide-for-privateequity equity/?
utm_source=upslidewebsite&utm_content=footer)
(https://upslide.net/solution/upslide-for-assetAsset
managementmanagement/?
utm_source=upslidewebsite&utm_content=footer
(https://upslide.net/solution/upslide-forCorporatescorporates/?
utm_source=upslidewebsite&utm_content=footer)
Resources
Knowledge(https://upslide.net/knowledge-hub/?
hub
utm_source=upslidewebsite&utm_content=footer)
Press(https://upslide.net/press/?
utm_source=upslidewebsite&utm_content=footer)
UpSlide(https://portal.upslide.net/?
Portal utm_source=upslidewebsite&utm_content=footer)
Help (https://support.upslide.net/hc/en-us?
center utm_source=upslidewebsite&utm_content=footer)
Pricing(https://upslide.net/pricing/?
utm_source=upslidewebsite&utm_content=footer)
ROI (https://www.upslide.outgrow.us/UpSlidecalculatorROICalculator?
utm_source=upslidewebsite&utm_content=footer)
Company
About(https://upslide.net/about-upslide/?
us utm_source=upslidewebsite&utm_content=footer)
Partners(https://upslide.net/partners/?
utm_source=upslidewebsite&utm_content=footer)
Careers(https://upslide.recruitee.com/?
utm_source=upslidewebsite&utm_content=footer)
Contact(https://upslide.net/contact/?
us utm_source=upslidewebsite&utm_content=footer)
7
5
2
6
4
)
S e)
of
t
w
ar
e)
Download