WEEK 1 — GET AND TRANSFORM (POWER QUERY) — PART 1
Get and Transform is a new and powerful way to import and manipulate data in Excel. This week is just the beginning.
You access Get and Transform on the Data Ribbon (it looks slightly different in older versions of Excel). Under
JOIN KINDS
Get Data you can select the source of
your data. Common sources include a When merging tables, you can choose what to do
Table in the current workbook, an Excel when there are rows that do not match between
or CSV file, or a database. You can also the tables. This is called the Join Kind. In older
import all files in a folder. versions of Excel, you need to edit the M code of
the merge to choose the Join Kind.
CREATE A TABLE APPEND QUERIES
When creating a query from data in the same Excel Left Outer Right Outer
Append queries allow you to stack
file it will automatically be converted to a table. It is datasets on top of each other. Ensure All rows from the first All rows from the
good practice to create the table yourself by going to that the tables have the same column table and matching second table and
Insert > Table or Ctrl+T. Rename the table on the names before appending them, rows from the second matching rows from
Table Design ribbon, then create the query. The otherwise Excel will not append table. the first table.
name will carry through to become the name of the correctly. The columns do not need to be in the M: JoinKind.LeftOuter M: JoinKind.RightOuter
query. If you do not wish to convert the data to a same order, but the names must match.
table, connect to it from a different workbook. Inner Full Outer
MERGE QUERIES
FORMULA BAR Only rows that match All rows from both
You use Merge when you want to add
Like the Excel workbook formula bar, the Power tables side-by-side (add columns from in both tables. tables.
Query Editor formula bar allows you to view and edit one table to another). When you Merge, M: JoinKind.Inner M: JoinKind.FullOuter
the M code for the current formula. Make it visible by you specify which columns contain the
going to View > Formula Bar. You can use the 𝑓𝑥 values used to match between the tables, Left Anti Right Anti
button to add a new custom step. often ID or Name. You can match multiple columns All rows in the first All rows in the second
LOAD TO by holding down Ctrl. table which do not table which do not
match the second match the first table.
When you import data, you can choose whether to SPLIT AND MERGE COLUMNS
table.
include it as a table in your workbook or just create a A common issue is having several pieces of M: JoinKind.RightAnti
connection. A connection is information in 1 column. You can use Split Column M: JoinKind.LeftAnti
useful if the query is used as to extract these into separate columns. There are
input to other queries, but RENAME A QUERY
many ways to split the data, depending on how your
you do not need to view it data is arranged. The opposite of this is Merge Just like with tables, it is good practice to give
directly. In O365 you can Columns, where you can take the contents of 2 or your query a suitable name. You can change it in
also load the data directly to more columns and join them together with the the Query Settings when you are creating it, or
a PivotTable or PivotChart. separator of your choice. Like TEXTJOIN in Excel. right-click > Rename in the Queries &
Connections panel.
Excel Power Tools for Data Analysis — Quick Reference Guide