You are on page 1of 45

Getting Started with Power

Query
Presented by: John Larimer
Prophet 21 World Wide User
Group Officers
President
Sam Snow Vice President of Operations
T. J. Snow Company, Inc. Ted Hoffman
Utility Supply and Construction
Vice President of Finance
Tim Edmunds
TSI Solutions Vice President of Member Relations
Eric Lunsford
Vice President of Marketing and Education Pye-Barker Engineered Solutions
Mike Chadwick
T. J. Snow Company, Inc.

CONNECT 2020 2
DISCLAIMER
• This conference is an attempt by P21WWUG members to assist each other
by demonstrating ways that we utilize the Prophet21 system and other related
products.
• The P21WWUG and the individuals conducting the classes and round tables
take no responsibility for potential issues that arise as a result of taking the
advice given during the conference.
• The P21WWUG does not recommend using any SQL statements to update
your database without having those statements first reviewed by Epicor or
other experienced SQL professionals. Test any code in your Play Database!
• Using SQL statements to update your database may result in corrupting your
database. Test any code in your Play Database!

CONNECT 2020 3
John Larimer
Motion and Flow Control Products – MFCP Inc.
jlarimer@mfcpinc.com

CONNECT 2020 4
1. Introduction
2. What does Get Data do?

Agenda 3.
4.
Data Sources
Transformations
5. M Language
6. Demo
7. Q&A

CONNECT 2020 5
About  Computer programmer with MFCP since 2005
 Began working in distribution in 1976, programming since 1994,
Me SQL development in 2003.
 Been on Prophet21 since 2013, worked on migration
 Recent projects are reporting, rule development and Windows
Form applications.
 Currently planning on moving to the web.

6
What does Power Query do?

Extract
 Load from multiple data sources (connectors)

Transform
 Format data before being loaded.
 Tracks all transformations for refreshes
 Merge (join) and Append (union) capabilities

Load
 Into Excel Table/Data Model (also Connection only)

7
Found under the Data Tab.

Get & Transform

8
Large Number Data Sources Available.
Here are samples from the first two options:

Data Sources
SQL Server database selected
Enter the name of your server and database.
After entering the Database information, you are presented
Table Navigator with the Table Navigator.
You can select multiple items.
Under the Advanced options, you can enter SQL
statements.

SQL Server
Advanced
Options
The editor is where you will transform the data.
This has a preview of the data with a limited number of rows in
the data set.
This editor has become a standard in Excel, Power BI and
Visual Studio SSAS Tabular as shown in the following slides.

The
Query
Editor
Excel
The
Query
Editor
Power
BI
Query Editor
VS2017
SSAS
Tabular
(level 1400)
This is the tab you land on when you first open the editor.
This has the Close & Load button.
Editor
Home
Tab
The transform tab has the tooling to modify existing columns
Editor and rows.

Transform
Tab
Use the Add Column tab to define new columns.
New columns are added at the last position, RMB to quickly
reposition.
Editor
Add
Column Tab
You can use this tab and check boxes to toggle options on and
off.
‘Go to Column’ is on this tab, helps you position to a specific
column.

Editor
View Tab
Editor
Select a row – the entire row is transposed in
the lower window.

CONNECT 2020 20
 As you work through the transformations, applied steps are
recorded and displayed on the pane to the right.
 If you make an error, you can simply delete a step and recreate.
 The formula bar shows the code for the highlighted step and allows
for editing.
 These applied steps will all be reapplied during a refresh,
eliminating manual formatting.
 Steps with a cog display a User Interface when you select for edit.

Applied Steps
 Applied steps can be renamed to help document your
query.
 Properties allows you to add additional documentation to
the step.

Applied Steps
Rename
Once you have finished shaping the data, you can Close &
Load the results.

Close & Load


You choose where you want the output sent.
‘Only Create Connection’ does not load data and can be
used by other queries you plan to build.

Load To
Merge
and
Append
 A merge is like an
SQL Join. You can
combine multiple
tables based on
multiple columns.
 An Append is like an
SQL Union. Two
tables of 50 rows
each will combine to
create a single table
of 100 rows.

CONNECT 2020 25
Merge
 To join on
multiple
columns, hold
the CTRL key
and select the
columns first
from each, then
the second and
so on…..
 Notice the
various options
for joining…

CONNECT 2020 26
Changing Query Defaults
From the Query Editor, click the File tab to access options.
My personal preference is to have the Default Load settings
set with both load options ‘unchecked’ allowing me to be
specific about where I want the data loaded.
This creates a ‘Connection Only’ query and prevents me
from loading data accidently and improves my productivity.

Query Options
Connection only, load to…
The load options can be changed with a RMB on the query.
Notice the other options available:
 Makes it easier to see the current queries and the older
connections in the same area.
 Note the toggle between queries and connections.
Queries  RMB the query to access options or double click to launch
the query editor.
&  TIP: You can copy/paste queries to this or other workbooks.
Connections
Queries
To work with legacy connections, click the Connections tab
and RMB or double click to pull up the properties window.

Queries
&
Connections
Connections
 As you transform the data, the editor builds a series of M
language statements.
 As you review the statements in the formula bar, you will
start to develop an understanding of what the language
is doing.
 Use the Advanced Editor to gain access to the entire
script.
M Language  You can turn scripts into Custom Functions.
 You do not need to know M to use Power Query.
For the applied step ‘Removed Other Columns’, the
generated formula is fairly easy to understand.
Formula Bar
The Advanced Editor window will show you the entire script.
The editor has limited functionality. There is syntax checking
but there is no IntelliSense or any other advanced features
typically found in code editors.
I have had success creating script templates where I can
just paste in the template to get started.

Advanced
Editor
Demo
Power Query – Overview and Learning - Excel

Resources
 Ken Puls – Excelguru
 Ken Puls – Bulgaria Excel Days 2017
The Value is in the Refresh
Resources
https://www.youtube.com/watch?v=JcVDZkk_38A
These people are great resources:
 Matt Allington – Excelerator BI
 Reza Rad - RADACAD
 Jon MacDougall – How to Excel
Most have blogs – if you subscribe, it
helps to keep you up to date on changes
 Rob Collie – Power Pivot Pro
 Chris Webb – Chris Webb’s BI Blog
 Webb - Power Query Beyond the Basics
https://www.youtube.com/watch?v=TpujELq3Iug

CONNECT 2020 37
 M is for (Data) Monkey
 Ken Puls

 ISBN 978-1-61547-223-9 (books.google.com)

 https://www.excelguru.ca
New book due out soon from Ken, “Master your Data with
Excel and Power BI”.
 High Impact Data Visualization in Excel with Power View, 3D Maps, Get

Resources & Transform and Power Bi


 Adam Aspin

 ISBN 978-1-4842-2400-7

 support.office.com

 Excel / Import and analyze data / Import data /


Getting Started with Get & Transform in Excel 2016
 Brian Grant - Power Query Jumpstarter
 Many other resources available on the web now.
Resources
If you want to get technical…..
Microsoft Power Query M Reference

Resources
Next Steps
 Rob Collie - Modern Excel
Keep Learning  https://www.youtube.com/watch?v=0WwFJ0Zg3d8

 www.powerpivotpro.com

 edx.org
Data Models
Power Pivot  Analyzing and Visualizing Data with Excel
Power BI  Analyzing and Visualizing Data with Power BI
DAX
Russo & Ferrari
Microsoft Press (discount code MVABOOK)
Analyzing Data with Microsoft Power BI and Power
Pivot for Excel
The Definitive Guide To DAX , 2nd Edition out now!
Tabular Modeling in Microsoft SQL Server Analysis
Services, 2nd Edition

www.sqlbi.com

www.daxpatterns.com

CONNECT 2020 42
Resources

Learn Dax!
Matt Allington
exceleratorbi.com.au

CONNECT 2020 43
 Overview of update channels for Office 365 ProPlus

Office 365
Update
Channels
The End
Thank you for attending!

John Larimer
Motion and Flow Control Products – MFCP Inc.
jlarimer@mfcpinc.com

You might also like