Exemplar Merging Two Data Sources
Exemplar Merging Two Data Sources
Overview
In the exercise Merging two data sources, you put into practice your understanding of how to
merge two data sources and by importing, merging and choosing join kind in Power Query.
Your objective in this exercise was to merge data sources by completing the following tasks:
This reading provides a step-by-step guide for completing these tasks, accompanied by
screenshots for comparison with your own copy.
1. Select the Text/CSV option from Get Data menu, in the Data group when the Home
ribbon tab is selected.
2. Select the Sales.csv file and then select Transform Data in the window that opened.
3. The Power Query Editor window opens. You can now select the queries that you want to
merge.
4. In Power Query Editor with the Home ribbon selected, select the New Source menu in
the New Query group and
choose Text/CSV.
5. Select Product.csv and then select OK.
Merge the Sales and Product queries, using Left Outer Join in the common column
ProductKey.
1. After selecting the Sales data in the Queries pane, under the Home ribbon, click Merge
Queries in the Combine group.
2. Choose Merge Queries inside the Merge Queries dropdown menu.
3. In the opened window, the Sales table will be automatically shown in the upper parts
choose Product in the
dropdown and click ProductKey columns in each table to mark the common column
between the tables.
4. For the Join Kind dropdown, choose the Left Outer Join which selects all records from
the left table and
After you merge the tables, a new column, named Product, is added to the right side of the
Sales table, which allows you to choose columns from the Product table.
1. Find the column named Product at the most right of the table and click on the expand
button to the right of the column.
2. Choose the Product column by clicking on it and deselecting any other columns. Note,
the Product query and column have the same names, so make sure you don’t get
confused.
3. Rename Product.Product column to Product.
Reorder the columns from the Sales table after merging them with Product table.
1. Your manager asked you to show the name of the product, so you won’t need the key
anymore. Remove
2. Move the newly added Product column between OrderDate and Quantity columns by
dragging and dropping them in place.
3. Remove Reseller, Employee and Sales Territory Key columns from the query.
4. Your final query will look like the image below after you have renamed, removed and
reordered columns.
Conclusion
Your objective for this exercise was to apply techniques for importing, formatting, and
merging data. In this context, you learned how to use Power Query Editor to import more
than one data source, merge them by using the common columns, choose the columns from
both tables and format the columns as needed.