top of page

You are learning Power Query in MS Excel

How to merge data from two or more tables in Power Query?

Merging data from multiple tables is a common task in Power Query. Here's how to do it:

1. Ensure your tables are loaded: Make sure the tables you want to merge are already loaded as queries in Power Query Editor. You can achieve this by importing them from different data sources or using existing Excel tables.

2. Initiate the Merge: Go to the "Home" tab in Power Query Editor. Click on "Combine" and then select "Merge Queries" from the dropdown menu. You can also choose "Merge Queries as New" if you want the merged data to be a separate query.

3. Select the tables and columns:

- In the "Merge" window, choose the first table you want to use as the primary table from the left dropdown menu.
- Next, select the column in the primary table that you want to use for the join. This column should have corresponding values in the secondary table for matching data points.
- In the right dropdown menu, select the secondary table you want to merge with the primary table.
- Finally, choose the corresponding column in the secondary table that matches the selected column in the primary table.

4. Choose the Join Kind (Optional):

- Power Query offers different join options depending on your needs. By default, it selects "Left Outer" which keeps all rows from the primary table and matching rows from the secondary table.
- Here are some common Join Kind options:
- Left Outer (all from first, matching from second): Keeps all rows from the primary table and matching rows from the secondary table. (Default)
- Right Outer (all from second, matching from first): Keeps all rows from the secondary table and matching rows from the primary table.
- Inner (only matching rows): Keeps only rows where there's a match in both tables based on the join columns.

5. Preview and Apply: The preview window will show you a sample of the merged data based on your selections. You can review it to ensure the join is happening as expected.

6. Click OK: Once you're satisfied with the join configuration, click "OK" to finalize the merge.

7. Manage Merged Columns (Optional): After the merge, Power Query might add prefix names to the columns from the secondary table to avoid duplicates. You can rename these columns for clarity in your final data set.

8. Close and Load: Once you've completed any necessary adjustments to the merged data, you can close and load it to your Excel worksheet. Click "Close & Load" and choose where you want to place the data (New worksheet, Existing table, etc.).

By following these steps, you can effectively merge data from two or more tables in Power Query, allowing you to combine information from different sources for further analysis and reporting.

bottom of page