Excel Power Query For Advanced
Excel Power Query For Advanced
2
Excel: Power Query for Advanced: A Step by Step Guide
1st edition
© 2022 Saskia Giessen & bookboon.com
ISBN 978-87-403-4264-2
Name and title of reviewer: Hiroshi Nakanishi
3
EXCEL: POWER QUERY FOR ADVANCED Contents
CONTENTS
Preface 5
7 Troubleshooting 78
7.1 Error Messages in Queries 78
Index 80
4
EXCEL: POWER QUERY FOR ADVANCED Preface
PREFACE
This manual was written to accompany our seminar on Microsoft Power Query. Its target
audience is users who need to import external data into Excel or transform data into Excel
before further processing.
The exercises in the book are easy to understand and can be adapted with little effort to
your own needs.
Power Query has very comprehensive feature set which is also easy to use. The software can
do a great deal of work for you without requiring any programming skills.
The output of Power Query is a list that you can then use for further analysis in Excel or
in the data model of PowerPivot.
You can download the sample files from the following website:
https://bit.ly/3JSpB7O
Saskia Gießen
Cologne, Germany
Mai 2022
5
EXCEL: POWER QUERY FOR ADVANCED VLOOKUP in Power Query
Power Query does not have the VLOOKUP() function, but the Merge Queries command
is much more powerful and much faster.
In this chapter, you will learn how to take multiple tables from Excel and merge them using
a key. The second example shows you how to process Access tables that are already related
to each other in Power Query.
In the section Understanding and Using Join Types, we introduce you to all six types of
join using sample data.
The practical example illustrates how flexible Power Query deals with different data sources.
The other two tables are much smaller and contain master data. In the Data List table,
you have stored the number of the salesperson for each sale. However, the name of the
salesperson is in the Salespersons table.
The material group number is similar. You can find the name of the material group in the
Groups table.
6
EXCEL: POWER QUERY FOR ADVANCED VLOOKUP in Power Query
In Excel, you would now use the VLOOKUP() function to assign the salesperson number
to the salesperson name, which is also in another spreadsheet. However, the processing speed
in Excel is slowed down by the VLOOKUP() for large amounts of data.
Now it’s time for Power Query: Here you have an elegant and fast solution.
Power Query allows you to select multiple tables in a workbook in one step.
• Take a new empty workbook and choose the command sequence Data / Get &
Transform Data / From File / From Workbook.
• Open the file Adv_Chapter1.xlsx.
• Select the Select multiple items option and activate all three tables.
7
EXCEL: POWER QUERY FOR ADVANCED VLOOKUP in Power Query
• Click on Edit.
• Check all tables to see if the column headers and data types match.
• In the left part of the editor, select the Datasheet query.
• Choose the command Home / Combine / Merge Queries.
• In the list field, choose the query Sales Reps.
• In both preview areas, select the column with the salesperson numbers Rep_No.
8
EXCEL: POWER QUERY FOR ADVANCED VLOOKUP in Power Query
• Leave the Left Outer (all from first, matching from second) entry activated in
the Join Kind field. This join corresponds to the VLOOKUP() function in Excel.
• Confirm with OK.
On the right a new column with the title Sales Reps has been added.
9
EXCEL: POWER QUERY FOR ADVANCED VLOOKUP in Power Query
• Click on OK.
10
EXCEL: POWER QUERY FOR ADVANCED VLOOKUP in Power Query
Figure 0-7: The new column with the names from the table Sales Rep
The new column is displayed. Now you see the name of the sales consultant for each sale,
just as the VLOOKUP() function would have done for you. Carry out the same steps for
the material groups:
• In the left part of the editor, select the Datasheet query and choose the
command sequence Home / Combine / Merge Queries.
• In the list field, choose the Category query and select both Cat_No columns.
11
EXCEL: POWER QUERY FOR ADVANCED VLOOKUP in Power Query
• Click on OK.
Now your query data list has two more columns Rep_Name and Cat_Name.
In the last step, the queries will be loaded to Excel. Note that you have to load all three
queries to Excel.
12
EXCEL: POWER QUERY FOR ADVANCED VLOOKUP in Power Query
Power Query has added three spreadsheets and has loaded one query per sheet. Now the
data transfer is finished and you can create your reports.
• Click in your new Datasheet table and select the command sequence Design /
Summarize with PivotTable. Confirm with OK.
• Drag the Gross profit field to the Values area. Design the sum in the currency
format.
• Drag the Rep_Name field to the Rows area.
• Drag the Cat_Name field to the Columns area.
• Format the values in the currency format.
• Finally, select Design / Report Layout / Show in Tabular Form to see the field
names in the pivot table.
13
EXCEL: POWER QUERY FOR ADVANCED VLOOKUP in Power Query
• Open the folder with the original data and activate the Sales Reps tab.
• Enter a new salesperson.
• Activate the Datasheet tab and enter a few records for the new seller.
Zeitmanagement
Finden Sie heraus, wie Sie Ihre Zeit besser nutzen
Download eBooks
14
EXCEL: POWER QUERY FOR ADVANCED VLOOKUP in Power Query
The new salesman Mr. York with the number 8 has started his work.
• Save the changes and close the workbook. Switch to your workbook
with the queries.
• Update the query Sales Reps and then the query Datasheet.
The data rows from the new sales representative has arrived in all tables.
• In the last step, switch to the pivot table and update the data with a right click
and the Refresh command.
The results for Mr. York has arrived in the pivot table.
15
EXCEL: POWER QUERY FOR ADVANCED Understanding and using Join types
2 UNDERSTANDING AND
USING JOIN TYPES
In this chapter, the usage and the results for the various types of link are presented. To
avoid too much theory, the types of »join data« are explained on examples.
The differences between the two lists are to be compared using the first column No. The
following is to be examined:
• Take a new empty workbook and fetch the two tables with the command
sequence Data / Get & Transform Data / From File / From Workbook.
• Activate the Select multiple items checkbox and select both tables.
16
EXCEL: POWER QUERY FOR ADVANCED Understanding and using Join types
• Click on Edit.
With these two queries we will describe all six types of join.
17
EXCEL: POWER QUERY FOR ADVANCED Understanding and using Join types
• Select the query week50 and choose the command sequence Home / Combine
/ Merge Queries / Merge Queries as New.
• In the list field, select the query week51 and in both queries, select the column No.
• In the Join Child field, choose Left Outer (all from first, matching from second).
The name of the join already describes the result: ALL records from the query week50
are displayed, because this query is the left one (the top one in the window). In addition,
all records from the week51 query are shown, where the content of the No column also
appears in the week50 query.
You can already see the result in the Merge window. For the 20 records from the week50
query, there are 15 matching records in the week51 query.
18
EXCEL: POWER QUERY FOR ADVANCED Understanding and using Join types
19
EXCEL: POWER QUERY FOR ADVANCED Understanding and using Join types
As a result, you see all the data for the query week50. Matching this, you see the data
records for the query week51. This means that for five records of the query week50 there
is no counterpart in the query week51.
Info: If you had done this with the VLOOKUP() function in Excel, #NV would appear
in cells H17 through O21.
• Double-click a query again to switch to the query editor and select the week50
query again.
• Perform all steps as described above.
• In the Join Child field, choose the entry Right Outer (all from second, matching
from first).
The name of the join also describes the result: ALL data records from the week51 query
are displayed, since this query is the right one (the lower one in the window). In addition,
all data records from the week50 query are displayed whose contents of the No column
are also in the week50 query.
20
EXCEL: POWER QUERY FOR ADVANCED Understanding and using Join types
You can see the result in the Merge window. For the twenty records from the week51
query, there are 15 matching records in the week50 query.
21
EXCEL: POWER QUERY FOR ADVANCED Understanding and using Join types
As a result, you see all the data for the query week51. You see the matching records for
the query week50. This means that for five records for the query week51, there is no
counterpart in the query week50.
Info: You could also have selected week51 as the first query and week50 as the second
query in the Merge window. As a join child, you could have selected Left Outer (all from
first, matching from second). Then the records of the week51 would be on the left.
22
EXCEL: POWER QUERY FOR ADVANCED Understanding and using Join types
• Switch back to the query editor and select the week50 query again.
• Perform all steps as described above.
• In the Join Child field, make the entry Full Outer (all rows from both).
The name of the join already describes the result: ALL data records from both queries are
displayed.
You can already see the result in the Merge window. For 15 of the 20 data records from
the week50 query, suitable counterparts are found in the week51 query.
23
EXCEL: POWER QUERY FOR ADVANCED Understanding and using Join types
As a result, you see all data records from both tables. Lines 2 to 16 have matching numbers
between the two queries. Lines 17 to 21 show the overhang from Week51 and the remaining
lines show the overhang from the Week50 query.
Kommunikationsfähigkeit
Finden Sie heraus, wie Sie ein besserer Kommunikator werden
Download eBooks
24
EXCEL: POWER QUERY FOR ADVANCED Understanding and using Join types
• Switch back to the query editor and select the week50 query again.
• Perform all steps as described above.
• In the Join Child field, choose the entry Inner (only matching rows).
The name of the join already describes the result: ALL data records from both queries are
displayed with the same entries in the No field.
Figure 0-14: Only matching rows with the join type Inner
25
EXCEL: POWER QUERY FOR ADVANCED Understanding and using Join types
As a result, you only see the data records that have matching values in the No field.
• Switch back to the query editor and select the week50 query again.
• Perform all steps as described above.
• In the Join Child field, select Left Anti (rows only in first).
26
EXCEL: POWER QUERY FOR ADVANCED Understanding and using Join types
Only the data records from the left (top) query week50 that are NOT in the query week51
are displayed.
• Click on OK.
This is the desired result. Only the records that are NOT in the week51 query.
27
EXCEL: POWER QUERY FOR ADVANCED Understanding and using Join types
• For completeness, click on the button in the week51 column, remove only the
tick from the Use original column name as prefix field and confirm with OK.
• Rename the query name to Left Anti.
• Now transfer the data to Excel with Home / Close & Load.
Only the records without a matching counterpart in the week51 query. Therefore, the
columns H to N are empty.
• Switch back to the query editor and select the week50 query again.
• Perform all steps as described above.
• In the Join Child field, make the entry Right Anti (rows only in second).
28
EXCEL: POWER QUERY FOR ADVANCED Understanding and using Join types
The name of the join already describes the result: Only the data records from the right
(lowest) query week51 are displayed that are NOT in the query week50.
This is the desired result. You will now see the fields from the Week50 query. Do not be
surprised that only an empty line is displayed.
• Make sure you click on the button in column week51, remove only the check
from the Use original column name as prefix field and confirm with OK.
• Give the query the name Right Anti.
• Now transfer the data to Excel with Home / Close & Load.
29
EXCEL: POWER QUERY FOR ADVANCED Understanding and using Join types
All records of the week51 query that do not have a matching counterpart in the week50
query.
Info: You could also have selected week51 as the first query and week50 as the second
query in the Merge window. If you were a join child, you could have selected Left Anti.
Then the overhang of week51 would be output immediately.
30
EXCEL: POWER QUERY FOR ADVANCED Unpivot data – convert results back to a list
3
UNPIVOT DATA – CONVERT
RESULTS BACK TO A LIST
This chapter explains how to convert data in the form of a pivot table or cross table into
a list. The following figure shows the desired result.
Figure 0-1: Our goal: Create a data list from a pivot table.
A data list is to be generated from the table in the left part in the columns A to I, as it is
displayed in the columns L to O. The data list is to be displayed in the columns L to O.
31
EXCEL: POWER QUERY FOR ADVANCED Unpivot data – convert results back to a list
• Activate the Data tab and start the From Table/Range command.
First, the empty cells of the Year column must be filled. Power Query provides a command
that writes the value of the cell above into all empty cells.
Info: If you want to populate multiple columns in your table, each column must be edited
individually with the following step.
• Select the Year column, activate the Transform tab, and start the command
sequence Fill / Down.
32
EXCEL: POWER QUERY FOR ADVANCED Unpivot data – convert results back to a list
In the column Year, all cells with null are filled with the value of the cell above.
Info: The Fill button-list also contains the Up command. Then the empty cells are filled
with the value that is in the cell below.
• Remove the Sum column. Right-click on the column header and start the
Remove command.
• In the Year column, filter out the Total row.
Figure 0-5: Hide the row with the overall result (Total)
• Select the columns from Apas-1 to Ugga-4. These are the columns with the values.
33
EXCEL: POWER QUERY FOR ADVANCED Unpivot data – convert results back to a list
Info: In the last step, you could also have selected the two columns Year and Month and
then obtained the same result with the command sequence Transform / Unpivot Columns
/ Unpivot Other Columns. The advantage of this procedure is that fewer columns have
to be selected.
34
EXCEL: POWER QUERY FOR ADVANCED Unpivot data – convert results back to a list
A data list has now been created from the pivot table.
In this example, the data is to be processed further with the Subtotal command. There is
a small problem here. As long as this list is a dynamic table, the Subtotal command is not
available on the Data tab.
To work with this command, you must turn the dynamic table into a normal table.
35
EXCEL: POWER QUERY FOR ADVANCED Unpivot data – convert results back to a list
Before using the Subtotal command, sort the data by the column you want to group.
Info: You could also have performed the sorting in Power Query.
• Leave the cursor in the list and choose the command sequence Data / Subtotal.
• In the At each changes in field, choose Attribute.
• Leave the Sum function in the Use function field.
• Leave the Value checkbox in the Add subtotal to field.
36
EXCEL: POWER QUERY FOR ADVANCED Unpivot data – convert results back to a list
The data is grouped according to the Attribute column and the contents of the Value
column are addes.
By clicking on the icons you can show and hide rows. If you click on them, for
example, you will only see the partial results and the total.
37
EXCEL: POWER QUERY FOR ADVANCED Unpivot data – convert results back to a list
Info: If you want to see the result elsewhere, select the cells. Select the command sequence
Home / Find & Select / Go to Special, activate the option Visible cells only and confirm
with OK. Now copy the cells and paste them into another place.
38
EXCEL: POWER QUERY FOR ADVANCED Many useful tools in Power Query
In Power Query, you can output not only results in list form, but also cross tables.
A highlight is the Distinct Count command, which counts unique rows. You can use this
function to determine how many customers buy from you per month. It does not matter
whether a customer orders more than once, he is counted only once.
39
EXCEL: POWER QUERY FOR ADVANCED Many useful tools in Power Query
The CSV file contains over 4,200 data rows. If you selected Based on entire dataset, Power
Query checks all cell contents per column for data type detection.
• Click on the Load button as you assume that everything is fine with the data.
Now you want to create a pivot table from this data that is grouped by years.
• Activate the Design tab and start the Summarize with PivotTable command.
Excel already offers you the correct cell range in the Create PivotTable window.
Confirm with OK.
• Drag the Gross_profit field to the Values area. Design the result in $-format.
• Drag the Year field to the Rows area.
40
EXCEL: POWER QUERY FOR ADVANCED Many useful tools in Power Query
Figure 0-4: The pivot table from the currently imported data
Now you can see that there is something wrong with the sales data. Sales in 2018 are
significantly higher than expected. You can check directly in Excel whether duplicates appear
in the data list.
• Switch back to the data list and select all the cells in the first column.
• Select the command sequence Home / Conditional Formatting / Highlight
Cells Rules / Duplicate Values.
• Set the desired color in the second list box.
41
EXCEL: POWER QUERY FOR ADVANCED Many useful tools in Power Query
Now all duplicates are highlighted in color. If you only want to see the duplicate values,
use the filter.
• Click on the filter in the Number column and point to the Filter by Color entry.
• Select either the Fill or the Font color.
42
EXCEL: POWER QUERY FOR ADVANCED Many useful tools in Power Query
Now you can directly start the command sequence Home / Remove Rows / Remove
Duplicates. However, in Power Query you first want to see which data is duplicated.
In Power Query, you can display which document numbers occur twice.
• Click on the Add grouping button and select the Year field.
• In the lower part of the window, you decide which calculation step is to be used
to summarize the data.
• In the Operation field, select Count Rows.
43
EXCEL: POWER QUERY FOR ADVANCED Many useful tools in Power Query
Info: In this example, you already know that each row from the year 2018 occurs twice. If
you are not sure, you can use the Add grouping button to add all fields to the table. Then
all values in the record are checked.
Note the scroll bar in the Group by window. For many fields, the display often does not
scroll down.
All unique values are given a 1, the rest a 2. If you only want to see the rows with the 2,
use the filter.
• Note that Power Query may not display all data at the beginning.
Figure 0-8: The hint that not all values are visible in the filter
44
EXCEL: POWER QUERY FOR ADVANCED Many useful tools in Power Query
Figure 0-9: Only the document numbers that are contained more than once.
The last two steps are not necessary for this example. They were used to show you how to
display duplicate values in Power Query.
• Delete the last two steps Filtered Rows and Grouped Rows by clicking
on again.
• Now select the Number column.
• Select the command sequence Home / Remove Rows / Remove Duplicates.
45
EXCEL: POWER QUERY FOR ADVANCED Many useful tools in Power Query
Power Query has now removed all rows from the list that contain duplicate values in the
Number column.
If there are duplicate rows in your CSV file the next time, you can use this query to ensure
that only correct data is evaluated.
46
EXCEL: POWER QUERY FOR ADVANCED Many useful tools in Power Query
Power Query has already recognized the first row as the heading and assigned a data type
to all number columns.
Figure 0-12: The new query with which a cross table is created
47
EXCEL: POWER QUERY FOR ADVANCED Many useful tools in Power Query
Figure 0-14: The interim result shows sales per material and year.
In the next step, bring the years into the column headers.
48
EXCEL: POWER QUERY FOR ADVANCED Many useful tools in Power Query
Now you have created a cross table. You can see the turnover per material and year.
Info: You could also create this evaluation in Excel with a pivot table. The advantage of
Power Query is the small file size of the workbook.
• In the last step, select the command sequence Home / Close & Load.
• Give the worksheet the name Crosstab.
Power Query has already recognized the first row as a heading and assigned a data type to
all number columns.
49
EXCEL: POWER QUERY FOR ADVANCED Many useful tools in Power Query
You only need three columns for the next steps. Therefore, remove the remaining columns.
• Select the columns Year, Month and Cust_No while holding down [Ctrl].
• Right-click the marker and select Remove Other Columns.,
Info: Of course, you could also have selected the five columns you want to delete and started
the Remove command. But marking so many columns is sometimes a bit difficult. Note
in this context that if you delete multiple columns in succession, Power Query combines
these commands in one step.
Info: If you want to know how many customers you have in this list, select the column
Cust_No. Select the command sequence Transform / Statistics / Count Distinct Values.
The result is 70, which means that you are dealing with 70 customers. Delete this step
from the list of applied steps.
Now you want to know how many customers have bought from us in January 2016, how
many in February 2016, etc.
50
EXCEL: POWER QUERY FOR ADVANCED Many useful tools in Power Query
Now you can see that 52 of your customers bought from us in January 2016. The representation
is currently still available in list form. If you want to turn it into a cross table again, you
only have to pivote the list.
51
EXCEL: POWER QUERY FOR ADVANCED Many useful tools in Power Query
• Click on OK.
You can see that an average of 50 of your 70 customers order from you each month. Even
if a customer has placed several orders in one month, he will only be counted once.
• In the last step, select the command sequence Home / Close & Load.
• Give the worksheet the name Distinct Count.
52
EXCEL: POWER QUERY FOR ADVANCED Calculations and more
This chapter shows examples of text and date functions and how to use the If function.
Info: If you have created formulas, you should not change the column headers in the original
file. Power Query does not automatically change formulas other than in Excel.
53
EXCEL: POWER QUERY FOR ADVANCED Calculations and more
To separate the contents in one step, you must use a text function.
In the Custom Column window, enter the required formula. To get help, you must go to
the Internet.
• Find the link Power Query formula categories and click on it.
• Click on the Text functions entry to see all text functions directly.
54
EXCEL: POWER QUERY FOR ADVANCED Calculations and more
55
EXCEL: POWER QUERY FOR ADVANCED Calculations and more
Info: Copying the syntax and pasting it in the Custom Column window saves you a lot
of work.
• Select the first parameter string as nullable text and double-click the Material
entry in the Available columns field on the right.
• Remove the parameter count as number and enter 6 there.
• In the New column name field, enter the name Material_no.
56
EXCEL: POWER QUERY FOR ADVANCED Calculations and more
The first six characters of the Material column are displayed in the new Material_no column.
In the first parameter text as nullable text, specify the column whose contents you want
to read. In the second parameter offset as number, specify the start value, i.e. the number
of characters from which you want to start. The third parameter is optional and specifies
how many characters should be taken. If the parameter remains empty, all characters are
taken from the start value.
=Text.Range([Material],9)
57
EXCEL: POWER QUERY FOR ADVANCED Calculations and more
Starting with the ninth character, all characters in the Material column should be transferred
to the new column.
Figure 0-10: Die Inhalte der Spalte Material auf zwei Spalten verteilt
The contents of the Material column were distributed to two columns using two functions.
58
EXCEL: POWER QUERY FOR ADVANCED Calculations and more
For example, you can search for the first space character. The Text.PositionOf function
displays the position number of a particular character. In Excel these would be the functions
SEARCH() or FIND().
=Text.PositionOf([#“Material_Group „],“ „)
59
EXCEL: POWER QUERY FOR ADVANCED Calculations and more
You can’t do much with this result alone in this example. However, you can use it in a
different formula.
60
EXCEL: POWER QUERY FOR ADVANCED Calculations and more
You have now read the material group. You can use the two functions to read values of
different lengths.
=Text.Start([#”Material_Group “],
Text.PositionOf([#”Material_Group “],” “))
61
EXCEL: POWER QUERY FOR ADVANCED Calculations and more
The Text.PositionOf function finds the position of the first blank character. This value is
used as the second value in the Text.Start function. The Text.Start function extracts all
characters from the left up to the determined value of the Text.PositionOf function.
Now you have read out the material groups in one step.
In the last step, you want to read the material name. The best way to do this is to search
for the »-« character.
62
EXCEL: POWER QUERY FOR ADVANCED Calculations and more
=Text.Range([#”Material_Group “],
Text.PositionOf([#”Material_Group “],”-”)+2)
The formula searches for the -. The last parameter of the Text.Range function remains empty
because everything is to be displayed from the position number found.
63
EXCEL: POWER QUERY FOR ADVANCED Calculations and more
By changing the data type, you can now recognize the EAN numbers.
If you want to transfer the data to Excel now, you can first remove the columns that you
do not need for your work. With the command sequence Start / Close & Load you enter
your transformed data into Excel and evaluate your data.
Info: The formulas are not transferred to Excel. The Workboook only receives a copy of
the values.
• Stay in the current Excel folder and choose the command sequence Data / Get
& Transform Data / Get Data/ From File / From Workbook.
• Select the file Adv_Chapter5_Functions.xlsx and select the table IF.
64
EXCEL: POWER QUERY FOR ADVANCED Calculations and more
In the first step, you want to automatically divide your materials into material groups. In
this example, all materials whose sales price is less than 3 dollars are to be distributed to
group ALPHA and the rest to group BETA.
65
EXCEL: POWER QUERY FOR ADVANCED Calculations and more
All materials whose selling price is less than 3 euros are automatically included in the
ALPHA group. All other materials end up in the BETA group.
In this example, all materials whose sales price is less than 3 euros are to be returned to
group ALPHA. All materials whose sales price is less than 10 euros are to be transferred
to the material group BETA. All other materials are to be returned to the material group
GAMMA.
66
EXCEL: POWER QUERY FOR ADVANCED Calculations and more
67
EXCEL: POWER QUERY FOR ADVANCED Calculations and more
There are also some functions that are not ready in Excel. For example, you can determine
the quarter directly from a date.
For later evaluation, you need information on the date from the Ordered on column.
• Close the folder, take a new empty folder, and choose the command sequence
Data / Get & Transform Data / Get Data/ From File / From Workbook.
• Select the file Date.xlsx and click Edit.
• Assign the data type Date to the Ordered and Supplied columns.
68
EXCEL: POWER QUERY FOR ADVANCED Calculations and more
In this example, you want to read the year, month and day from the »Ordered date« into
individual columns.
• Click with the right mouse button on the column header Ordered and select
the command Duplicate Column.
In the new column, you only see the year. You can see the function in the editing bar:
Date.Year
69
EXCEL: POWER QUERY FOR ADVANCED Calculations and more
Perform these steps twice and also extract the month and day from the Ordered column.
Your table now looks like this:
With the help of the right mouse button, you can quickly split dates into their individual
parts and convert them.
Info: If you prefer to receive the name of the month, choose Transform / Month / Name
of Month.
70
EXCEL: POWER QUERY FOR ADVANCED Data from the Web
• Start your browser, open the Wikipedia page and search for the keywords New
York City Population.
71
EXCEL: POWER QUERY FOR ADVANCED Data from the Web
• Click OK.
Info: Please note the license and terms of use on the respective websites.
72
EXCEL: POWER QUERY FOR ADVANCED Data from the Web
The first step is to change the contents in the Pop. column. However, you cannot assign a
finished data type, such as Whole Number, as before. You must name the locale Power Query.
73
EXCEL: POWER QUERY FOR ADVANCED Data from the Web
Info: You must select the area schema that the column currently contains.
• Click on OK.
In the next step the contents of the column ±% should be edited. The Replace values
command provides help here.
By selecting the first cell, the content is already written into the Value to search field.
74
EXCEL: POWER QUERY FOR ADVANCED Data from the Web
Unfortunately, the negative sign is not recognized as such during import, so you must also
use the Replace Values command here.
75
EXCEL: POWER QUERY FOR ADVANCED Data from the Web
• Select the cells from A1 to B32 and create a Line with Markers diagram.
76
EXCEL: POWER QUERY FOR ADVANCED Data from the Web
The following changes have been made for the next figure:
You can update the diagram and the evaluation by updating the Query.
77
EXCEL: POWER QUERY FOR ADVANCED Troubleshooting
7 TROUBLESHOOTING
If Power Query is running smoothly and you do not receive an error message: Congratulations.
In this chapter we have logged all the pitfalls we noticed when creating this book.
One of the most common error messages in queries is caused by changed column captions.
Someone has thoughtlessly changed a column header in the source file and your query
reports an error.
• Choose Home / Advanced Editor and enter the new column name in all places.
• Click on the Done button.
If you do not know the new column name and do not recognize it, the display in Excel
remains in the last display despite errors.
78
EXCEL: POWER QUERY FOR ADVANCED Troubleshooting
Your queries also report an error if the source file has been renamed or moved.
• In the Query Editor, select File / Options and Settings / Data source settings.
• Select the desired file and click the Change Source button.
• Enter the new path and/or file name, click OK, and then on Close.
• Click the Refresh Preview button.
Again, Power Query has a good feature: the dynamic Excel table on which the query is
based does not change. You can continue working with the old version.
There is an option in the settings in the Excel options that you can use to deactivate the
connection of your data to Power Query.
If you want to update your query and a window appears informing you that the connection
is not active, you must perform the following steps:
79
EXCEL: POWER QUERY FOR ADVANCED Index
INDEX
C P
Count Distinct Rows 50 pivot table 13, 15, 31, 32, 35, 40, 41, 46, 49
D R
Distinct Count 39, 49, 52 right anti 28
Right Anti 28, 29
E
Right Anti-Join 28, 29
Error Messages 78 Right Outer 20, 21, 22
F T
file was moved 79 Text.PositionOf 58, 59, 61, 62, 63
Full Outer 22, 23, 24 Text.Range 57, 58, 62, 63
I Troubleshooting 78
Inner Join 25 U
Join V
Right Anti 28
VLOOKUP 6, 7, 9, 11, 17, 20, 78
L
W
Left Anti 26, 27, 28, 30
Wikipedia 71, 76
Left Outer 9, 17, 18, 19, 20, 22
80