0% found this document useful (0 votes)
1 views

Exemplar Merging Two Data Sources

The document provides a step-by-step guide for merging two data sources using Power Query in Power BI. It outlines tasks such as downloading CSV files, importing datasets, merging queries with a Left Outer Join, selecting and reordering columns. The exercise aims to enhance skills in importing, formatting, and merging data effectively.

Uploaded by

Aya Laadaili
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

Exemplar Merging Two Data Sources

The document provides a step-by-step guide for merging two data sources using Power Query in Power BI. It outlines tasks such as downloading CSV files, importing datasets, merging queries with a Left Outer Join, selecting and reordering columns. The exercise aims to enhance skills in importing, formatting, and merging data effectively.

Uploaded by

Aya Laadaili
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

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:

Download CSV Files


Open Power Query Editor
Choose Queries
Merge Queries
Select Column(s) from Product
Choose and reorder columns from Sales

This reading provides a step-by-step guide for completing these tasks, accompanied by
screenshots for comparison with your own copy.

Step 1: Download CSV files

Download Sales.csv and Product.csv files.


Step 2: Create a Power BI project

1. Create a Power BI project and open the Power Query editor.


2. Create a new Power BI project called Exercise – Merging two tables.

Step 3: Open the Power Query Editor

Import your datasets, Sales and Product.

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.

Step 4: Merge queries

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

matching records from the right table.

Step 5: Select column(s) from Product

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.

Step 6: Choose and reorder columns from Sales

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

ProductKey column by right clicking on the column and select 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.

You might also like