Power Query Left Outer Join Guide and Examples
In this article
A Power Query Left Outer Join allows you to merge two tables by keeping all rows from the first (left) table and only adding matching rows from the second (right) table. If no match is found in the right table, the resulting columns will contain a null value. This is the most common merge type used for enriching a primary dataset with supplemental information without losing any original records.
What You'll Need
- Microsoft Excel or Power BI Desktop installed on your machine.
- Two data sources (tables, CSVs, or database queries) already loaded into the Power Query Editor.
- A common "key" column present in both tables (e.g., a Customer ID, Order Number, or SKU) that can be used to link the records.
Step-by-Step
- Open the Power Query Editor. In Excel, go to the Data tab and select Get Data > Launch Power Query Editor. In Power BI, click Transform Data on the Home ribbon.
- Select the primary table from the Queries pane on the left. This is your "Left" table. Every row in this table will be preserved in the final output regardless of whether a match is found in the second table.
- On the Home tab, locate the Combine group and click Merge Queries. You can choose "Merge Queries" to modify the current table or "Merge Queries as New" to create a third, separate table. Note that menu labels may differ slightly based on your software version or region.
- In the Merge window, the first table is already displayed at the top. Click the dropdown menu in the center of the window to select the second table (the "Right" table) from your list of queries.
- Click on the matching column in the top table, then click on the corresponding matching column in the bottom table. The columns will be highlighted to indicate they are selected. If you need to match based on multiple columns, hold the Ctrl key and click the columns in the same order for both tables.
- Under the Join Kind dropdown menu, select "Left Outer (all from first, matching from second)". This is usually the default selection.
- Review the preview pane at the bottom of the window. It will show you how many rows from the first table will have matches and how many will result in nulls. Once satisfied, click OK.
- The merge will create a new column at the end of your left table. This column contains "Table" objects. To see the actual data from the right table, click the Expand icon (two diverging arrows) in the top-right corner of the column header.
- In the Expand menu, uncheck "Use original column name as prefix" to keep your headers clean. Select only the specific columns you want to bring over from the right table and click OK.
- Verify the data. Rows that did not have a match in the right table will now show as null in the newly expanded columns.
Common Mistakes
One of the most frequent errors is selecting the wrong table as the "Left" table. Because a Left Outer Join preserves all records from the first table, swapping the order of your tables can lead to data loss. For example, if you merge a small "Sales" table into a large "Products" table using a Left Outer Join, you will see every product in your catalog, even those that never sold. If you do the reverse, you will only see products that have sales, effectively turning the operation into an Inner Join if you aren't careful.
Another common mistake is ignoring data type mismatches. Power Query is strict about data types. If your "Customer ID" in the left table is formatted as Text, but the "Customer ID" in the right table is formatted as a Whole Number, the merge will fail to find any matches, resulting in a table full of nulls. Always ensure that the joining columns have the exact same data type before attempting the merge.
Users also often forget to handle duplicate keys in the right table. If the right table has multiple rows for a single key (e.g., one customer has three different addresses), a Left Outer Join will duplicate the row from the left table to accommodate every match. This can lead to "data inflation," where your total sales figures suddenly double or triple because the rows were duplicated during the merge.
Tips
To prevent data inflation caused by duplicates in the right table, use the "Remove Duplicates" feature on the key column of the right table before performing the merge. This ensures a one-to-one or many-to-one relationship, keeping your row count stable.
If you are working with very large datasets, performance can slow down during a merge. To optimize this, try to remove any unnecessary columns from both tables before the merge step. The less data Power Query has to hold in memory while scanning for matches, the faster the operation will complete.
Use the "Fuzzy Matching" option if your join keys are text-based and might have slight variations, such as "Microsoft" vs "Microsoft Inc." This feature is found in the Merge window under "Use fuzzy matching to perform the merge." You can adjust the similarity threshold to control how strict the matching process is.
When expanding the joined table, avoid selecting all columns. Only pick the specific fields you need for your report. This reduces the memory footprint of your model and makes the final table easier to read and navigate.
Troubleshooting
If your merge results in 100% null values despite the data appearing to match, first check the data types. Select the key column in both queries and ensure they are both set to the same type (e.g., both Text or both Whole Number). If they match, check for leading or trailing spaces. A cell containing "ID123 " will not match "ID123". To fix this, right-click the column header, select Transform, and choose Trim.
If the merge is taking an extremely long time or causing the application to freeze, check if you are merging two massive tables without a clear index. If possible, try to filter the right table to only include necessary rows before the merge. If you are connecting to a SQL database, Power Query will attempt "Query Folding," meaning the join happens on the server. If you have added complex transformation steps before the merge, folding may break, forcing Power Query to download all data locally to perform the join. Try moving the Merge step earlier in your applied steps list to restore folding.
If you notice that your row count increased unexpectedly after the merge, you have a many-to-many relationship. Go back to the right table and check for duplicate keys. Use the "Group By" feature or "Remove Duplicates" to ensure each key appears only once if you only need a single attribute from the right table.
Frequently Asked Questions
How is a Left Outer Join different from an Inner Join?
A Left Outer Join keeps all rows from the first table regardless of a match. An Inner Join only keeps rows where a match exists in both tables, discarding any unmatched rows from both sides.
Can I join more than two tables using a Left Join?
Yes, but you must do it sequentially. Merge Table A and Table B first, expand the results, and then perform a second Merge operation between the resulting table and Table C.
What does the "null" value actually mean in my merged table?
A null value indicates that the key in the left table did not find any corresponding match in the right table. It is the standard way Power Query represents missing data after a join.
Does a Left Outer Join change the original source data?
No, Power Query is a non-destructive transformation tool. It creates a set of instructions (Applied Steps) to reshape the data for your report, but the original files or databases remain untouched.
Can I use multiple columns as a join key?
Yes. In the Merge window, hold the Ctrl key and select multiple columns in the first table, then select the matching columns in the second table in the exact same order.
Why is my merge slow even with small tables?
This often happens if the data is being pulled from a slow network drive or a web API. Try loading the data into a local cache or ensuring your connection is stable before running the merge operation.