New Tool Radar

AI for Data & Spreadsheets

How to Check How Many Rows Matched After a Power Query Merge

Check how many rows matched and how many were left unmatched after a Power Query merge.

Schematic with three steps: Expand the merged column and count the; Compare the matched count with the row; Check the unmatched keys against the second.

A Power Query merge joins two tables on a key, and the result depends on the join kind and on how many keys actually match. A left join keeps every row from the first table and fills the unmatched ones with nulls, so the merged table looks complete while some rows carry no data from the second table. Count the matched and unmatched rows before using the merged result.

What you need

  • The two queries and the merge step between them
  • The key column in each query
  • A note of which join kind the merge should use

Step 1: Expand the merged column and count the nulls

After the merge, expand the new column and count how many rows show null in the merged fields. Nulls are the rows from the first table that found no match in the second.

Step 2: Compare the matched count with the row counts

Count the rows in each table and the matched rows in the merged result. If the merged table has fewer rows than the first table, the join kind dropped unmatched rows; if it has more, duplicate keys in the second table multiplied them.

Step 3: Check the unmatched keys against the second table

Filter the merged table to the null rows and read their keys, then look for those keys in the second table. Fix the key format, the case or the trailing spaces that stopped the match, then re-run the merge.

Worked example: synthetic orders merged with customers

The table below is a synthetic example. It shows the expected result of checking a merge match count; no query was run.

Check Count Result
Orders in the first table 40 Source
Customers in the second table 35 Source
Orders matched to a customer 37 Matched
Orders with no customer 3 Null after merge
Cause found Trailing space In 3 customer keys

Expected result (UNTESTED). 37 of 40 orders match a customer, and 3 show null because their customer keys carry a trailing space in the second table. Trimming the keys and re-merging matches all 40 orders. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • A left join keeps unmatched rows with nulls; an inner join drops them, so the join kind decides what the count means.
  • Duplicate keys in the second table multiply the rows in the result, so the merged table can be larger than the first.
  • Keys that differ only by case or a trailing space do not match; clean both key columns first.
  • A merge on a text key and a number key never matches, even when the digits look the same.

Sources

See all