Exemplar: Appending two tables
Overview
In the exercise Appending two tables, you put into practice your understanding of how to combine a data
set by importing, formatting, and appending data in Power Query.
Your objective for this exercise was to prepare a worksheet for analysis by completing the following tasks:
Download Excel Files
Open Power Query Editor
Format Excel Files
Append Queries
Rename the New Query
This reading provides a step-by-step guide for completing these tasks, accompanied by screenshots for
easy comparison with your own copy.
Step 1: Download Excel files
Download [Link] and [Link] files, which will be used in this exercise.
Step 2: Open the Power Query Editor
Open the Power Query editor and import your datasets, AdventureWorksSales and OtherSales.
1. Navigate to the Home ribbon tab at the top of the Power BI window.
2. Select the Excel Workbook button inside the Data group, in the middle of the toolbar.
3. Select [Link] and [Link] files respectively and select Transform Data in
the opened window.
1. The Power Query Editor window opens. You can now begin formatting the data.
Step 3: Format Excel files
You will append OtherSales data to AdventureWorksSales data. So, you will use AdventureWorks sales data
as the first table and OtherSales data as the second table. For this reason, format OtherSales data and
rename the column names to the same names as the column names in AdventureWorksSales data.
1. Select the OtherSales query in the Query pane at the left menu of the Power Query window.
2. Rename the Quantity column to OrderQty by selecting the column.
1. Repeat the same changing operation for the column Name to ProductName.
2. Change the column Total to LineTotal.
Step 4: Append queries
Append queries in a new master table.
1. Select the Append Queries dropdown menu inside the Combine group, in the Home ribbon bar.
1. Select Append Queries as New from the Append Queries dropdown menu.
2. Select the Two Tables radio button. Select AdventureWorksSales as the first table and OtherSales as
the second table.
1. Alternatively, you can select the Three or more tables radio button and use the drag and drop
functionality. You can also select the tables you want from Available Tables and add them to Tables to
Append.
1. Find the new query named Append1 on the left menu Queries pane.
2. Check the column names, row numbers, and the format of the appended query. Verify that there are 8
columns and 124 rows at the bottom left in the status bar.
Step 5: Rename new query
Change the name of the new query to Consolidated Sales.
1. In the left menu, select the new query and change its name by typing its name as Consolidated Sales
and press Enter on the right pane, named Properties.
Conclusion
Your objective for this exercise was to apply techniques for importing, formatting, and combining data. In
this context, you learned how to use Power Query Editor to import more than one data source, change the
names or formats of the columns when needed before appending, append tables and queries, and create a
new combined master table with a given name.