Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Power Query Join Examples: Merge Types Explained

· 7 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Power Query joins (called Merge Queries in the interface) combine two tables into one by matching rows on a shared column, and the quickest working example is this: load both tables into Power Query, select the Home table, open Home > Merge Queries, click the matching column in each preview, choose a join kind such as Left Outer, then expand the merged column to pull the fields you want. The join kind you pick decides which rows survive, so most of the skill is choosing the right one. Menu labels can differ slightly by version, device or region.

What You'll Need

  • Excel (Power Query is built into the Data tab) or Power BI Desktop, which uses the same engine and dialog.
  • Two or more tables in the same workbook or data model, or connected sources you can load into the Power Query Editor.
  • One column in each table that holds comparable values — a customer ID, product code, SKU, date, or exact name. Data types must agree.
  • A few minutes to inspect both key columns for duplicates, blanks and leading or trailing spaces before merging.

Step-by-Step

  1. Load both tables into the editor. In Excel, select a table and use Data > From Table/Range; in Power BI, use Get Data. If the tables are queries already, they appear in the Queries pane on the left. Give each a clear name such as Orders and Customers.
  2. Check the key column first. Click the column header in each query and confirm the data type shown in the header matches (both Text or both Whole Number, for example). A number stored as text will never match a real number, which is the single most common cause of empty joins.
  3. Start the merge from the table you want to keep. Select Orders in the Queries pane, then on the Home tab choose Merge Queries (use Merge Queries as New if you want to keep the originals untouched — often the safer choice).
  4. Pick the second table and click the matching column in each preview. The dialog shows both tables side by side. Select CustomerID in the top preview and the corresponding CustomerID in the bottom one. The header of each selected column turns bold. If the names differ, click them anyway — matching is by position in the dialog, not by name.
  5. Choose the join kind from the dropdown. The options are Left Outer, Right Outer, Full Outer, Inner, Left Anti, Right Anti, and (where you select more than one column) the position-based variants. Hover each one to read its description; the little diagram shows which rows are kept.
  6. Click OK and inspect the new column. A column appears containing the word Table in every row — that is a nested table, not yet usable data.
  7. Expand the columns you need. Click the expand icon (two diverging arrows) in the new column header. In the list, untick Use original column name as prefix if you find the prefixes noisy, select only the fields you want, and confirm. Now the joined values sit alongside your original row.
  8. Verify the row count and nulls. Compare the number of rows before and after. A Left Outer join should keep every row of the left table; if the count grew, the right table has duplicate keys. Filter the expanded column for nulls to find unmatched records.
  9. Apply and close. Use Home > Close & Load (Excel) or Close & Apply (Power BI) to send the result to a worksheet or the model.

Worked example: adding a customer name to an order list

Suppose Orders has OrderID, CustomerID and Amount, and Customers has CustomerID, Name and Region. A Left Outer merge on CustomerID, followed by expanding Name and Region, gives one row per order with the buyer's details attached. Every order survives, even one whose customer record has been deleted — that row simply shows null in the new columns. Switch to Inner and those orphan orders disappear, which is exactly what you want when auditing that the lookup table is complete.

Worked example: finding rows that do not match

Use Left Anti on the same keys. The result is only the orders whose CustomerID is absent from Customers. This is a practical data-quality check you can run before any financial report. The mirror image, Right Anti, returns the customers with no orders.

Merging on more than one column

Hold Ctrl (Cmd on Mac) and click a second column in either preview to match on a composite key — for example Product plus Warehouse. The order of your clicks must be the same in both tables. This avoids false matches when a single code repeats across locations.

Common Mistakes

  • Mismatched data types. Text “00123” versus the number 123 matches nothing. Set both key columns to the same type, usually Text for identifiers with leading zeros.
  • Duplicate keys in the lookup table. A left table row duplicates once for every matching right row. De-duplicate the lookup (right-click the key column > Remove Duplicates) before merging.
  • Hidden spaces. Trailing spaces and inconsistent capitalisation break exact matches. Trim and standardise the key columns in both queries first.
  • Forgetting to expand. The merge leaves a nested table column; if you skip the expand step, nothing useful reaches your report.
  • Merging in the wrong direction. A Left Outer merge started from the wrong table keeps the wrong set of rows. Start from the table whose rows you must not lose.
  • Overwriting working queries. Merging the base query instead of using Merge Queries as New removes the original output and breaks anything that references it.

Tips

  • Rename queries meaningfully before merging and use the description field; you will thank yourself when the file has fifteen steps.
  • Do lookups in the query rather than with VLOOKUP or XLOOKUP formulas, so the refresh handles new rows automatically.
  • Watch the Applied Steps pane after each merge — clicking a step shows the intermediate result, which makes a wrong join kind obvious immediately.
  • Use Full Outer when reconciling two systems and you want to see both unmatched sides in one view.
  • For repeated lookups of the same shape, consider Table.Join in M for precise control over key equality and join kind.
  • Keep the key columns narrow in purpose — one column per concept — rather than matching on long free-text fields.

Troubleshooting

Every expanded cell is null

The keys are not matching. Compare data types first, then check for spaces, case differences and leading zeros. A quick test is to preview both key columns side by side and look for values that appear identical but sit at different sort positions.

Row count increased after the merge

Duplicates in the right-hand table. Remove duplicates on its key column, or decide which record should win and filter the lookup accordingly.

The merge dialog is greyed out or the column will not select

Look for a step filter above that has changed the columns, or an empty query. Remove error rows first; merges fail when key columns contain errors.

Query refreshes are very slow

Merging large tables on text columns is expensive. Filter each query as early as possible and reduce columns before the merge step, not after.

If that did not work

Duplicate the query, simplify it to just the two key columns, and merge that stripped-down pair. If the simple version matches correctly, a filter or type change upstream is the culprit; add the steps back one at a time to find it.

Frequently Asked Questions

What is the difference between Merge and Append in Power Query?

Merge joins tables side by side by matching keys in shared columns. Append stacks tables on top of each other, combining rows of the same shape. Use Merge for lookups, Append for combining monthly files.

Which join kind should I use most often?

Left Outer is the usual choice when adding lookup data to a fact table, because every row of the main table survives regardless of whether a match exists.

Can I match columns with different names?

Yes. Click the relevant column in each preview; Power Query matches the selected columns, not their names. Only the expanded output column names come from the right-hand table.

Why does the merged column say Table instead of values?

That column holds a nested table of matching rows. Click the expand icon in its header and select the fields to bring into the query as ordinary columns.

Can I merge more than two tables?

Yes, chain the merges: merge the first two, expand, then merge the result with a third query. Keep the steps readable by naming each intermediate query clearly.

Does merging change the original tables?

No, if you use Merge Queries as New, the source queries remain intact. Merging in place alters the selected query only, and the connected source data is never modified.