The term “Join” comes from the database world, and I’ll admit that I’ve struggled with understanding it... especially when you combine it with some other keywords. So this week I thought it would be good to explore it in a bit more detail, specially to show the different results when we merge tables using outer joins.
Different types of Outer Joins
There are actually three flavours of Outer Join you could come across, and each work in different ways. Those three flavours are:
- Left Outer join
- Right Outer join
- Full Outer join
Which… to an Excel person… mean very little. To confuse matters more, there are also Inner joins, and Anti joins. (We’ll look at those next week though.)
Sample Data
To illustrate the different join types, we are going to work with the set of data shown below (which you can download here.)

So two tables of data, one called Transactions, and one called ChartOfAccounts.
Now, the key piece you want to watch here is that we need the Account-Dept combination to exist in both tables in order to make a perfect join between them. Think VLOOKUP for a second… if you tried to make a VLOOKUP for account 10045 from the Transactions table against the ChartOfAccounts table, what would you get? Of course, you’d get #N/A since 10045 doesn’t exist in the ChartOfAccounts table.
In this case we have items in both tables that don’t exist in the other. (The yellow records in the Transactions table don’t have a match in the ChartOfAccounts table, and the red records in ChartOfAccounts don’t have a match in the Transactions table.) With these differences we can test how each of the first three join types available to us behave when we try to merge the data in both tables together.
Groundwork
Of course, the first thing we need is a pointer to each table for Power Query to work. So let’s set that up first.
- Click in the Transactions table –> New Query –> From Table
- Go to Home –> Close & Load –> Close & Load To… –> Only Create Connection
- Click in the COA Table –> New Query –> From Table
- Go to Home –> Close & Load –> Close & Load To… –> Only Create Connection
I also right clicked each query in the Workbook Queries pane and choose to move them to a group I called Source, just to keep them organized:

This will work nicely. We have a pointer to both tables, but didn’t cause any data duplication by loading a new copy to a worksheet.
Merge Tables using Outer Joins – Left Outer Join
Okay, let’s get started. We need to join these based on the combination of the Account and Dept number. Fortunately we can use the trick discussed in this post to do this with creating a concatenated key manually first:
- Right click the Transactions query and choose Merge
- Select ChartOfAccounts for the bottom table
- For the top query (Transactions) select Account, hold down CTRL and select Dept
- For the bottom query (ChartOfAccounts) select Account, hold down CTRL and select Dept
Your join selections should now look like this:

Notice that the Join Kind in the bottom is “Left Outer (all from first, matching from second). Let’s click OK and see what that means.
When you get into the Power Query editor:
- Right click the NewColumn column –> Rename –> COA
- Click the Expand icon on the top right of the COA column
- Leave all the defaults and click OK
The resulting query should look as follows (barring the colour of course):

So this is a “Left Outer Join” – the default choice for Power Query. It returns all entries in the left table (or top in the case of the power query editor) and returns the matching values it finds based on the lookup column. Essentially this is the same as VLOOKUP. It returns a match, except where it can’t find a matching record. (The main difference between VLOOKUP and Power Query is that if Power Query found multiple matching records, it would return all of them, not just one.)
Again, the key point here is that every value from the Left table is returned, whether there is a match or not in the Right table. The yellow rows here match the yellow rows in the original Transaction table shown at the beginning of the post.
But… notice also that accounts 10040 and 11000 (the red accounts in the COA table) do not shown in the listing at all. This is your Left Outer join in action. It pulls all records from the left table, any matches from the right (or null if no records on the right match). It never looks at the right side at all to see if records exist there that don’t exist in the left hand table.
Okay, so now we can see what’s happening here, let’s finish it off:
- Change the name of the query to LeftOuter
- Go to Home –> Close & Load –> Close & Load To… –> Only Create Connection
Merge Tables using Outer Joins – Right Outer Join
Rather than discuss the difference here, let’s just demo it. One caveat… it’s important to get a clear understanding that you start with same base table in order to make parallel comparisons!
- Right click the Transactions query and choose Merge
- Select ChartOfAccounts for the bottom table
- For the top query (Transactions) select Account, hold down CTRL and select Dept
- For the bottom query (ChartOfAccounts) select Account, hold down CTRL and select Dept
- Change the Join type to “Right Outer (all from second, matching from first)”
- Click OK
And then we’ll do the same thing we did before so that we can compare the results:
- Right click the NewColumn column –> Rename –> COA
- Click the Expand icon on the top right of the COA column
- Leave all the defaults and click OK
If you followed along correctly, your result should look like this:

Notice the big difference here? This time the values from the Right table (ChartOfAccounts) show whether there is a match in the Left (Transactions) table or not. The red rows (containing 10040 and 11000 from our original table) are now present, where they weren’t in the previous scenario.
But the (yellow) items that were in the Left (Transaction) table which don’t have a match in the Right (ChartOfAccounts) table? They’re nowhere to be seen!
Where I now know I struggled with this when writing SQL code from scratch is that no one ever explained to me which table was Left and which was Right. Lacking that knowledge there really isn’t anything to explain what these joins are truly doing. But now that we can see that the table we start our merge from is the Left table, and the one we are joining to it is the Right table… it starts to make a LOT more sense. The only kicker we have with Power Query is that the Left table is the top in our merge dialog, and the Right is the bottom. But you can certainly see why the UI was designed this way (imagine trying to fit it on your screen if it was side by side?)
At any rate, we can now compare and contrast those two joins. Let’s finish this one off and look at the final join we’ll examine today.
- Change the name of the query to RightOuter
- Go to Home –> Close & Load –> Close & Load To… –> Only Create Connection
Merge Tables using Outer Joins – Full Outer Join
By now, you know the drill…
- Right click the Transactions query and choose Merge
- Select ChartOfAccounts for the bottom table
- For the top query (Transactions) select Account, hold down CTRL and select Dept
- For the bottom query (ChartOfAccounts) select Account, hold down CTRL and select Dept
- Change the Join type to “Full Outer (all from second, matching from first)”
- Click OK
And now modify the query:
- Right click the NewColumn column –> Rename –> COA
- Click the Expand icon on the top right of the COA column
- Leave all the defaults and click OK
And what do we have?

Aha! So the Full Outer join makes sure we’ve got all items from both sides. I can see this being SUPER useful for trying to compare to lists of transactions like in a bank reconciliation. Transactions that match would get lined up nicely, and any that needed attention would have a bunch of nulls beside them on either side. Very cool. (I’ll have to do a post on that some day!)
Wrapping Up
This shows how to merge tables using Outer Joins… If you'd like to learn about the three remaining join types shown below, you can do so at this article:
- Inner Join
- Left Anti Join
- Right Anti Join