Merging queries in Power BI combines two tables into one by matching rows on a shared column, similar to a SQL JOIN or a VLOOKUP that returns many columns at once. You do it in Power Query Editor: load both tables, choose Merge Queries, pick the matching column in each table, choose a join kind, then expand the new column to bring the fields you need into a single table. Nothing needs to be installed beyond Power BI Desktop; the only prerequisite is that both tables are already loaded as queries and share at least one column with compatible values.
What You'll Need
- Power BI Desktop installed and open on a report where you can edit queries.
- Two or more queries already loaded into Power Query Editor (Home > Transform data opens it).
- A matching key column in both tables, such as a Customer ID, product code or date.
- The two key columns should be the same data type. Power Query will warn you if they are not.
Step-by-Step
- Open Power Query Editor from the Home ribbon by clicking Transform data. All your existing queries appear in the Queries pane on the left.
- Decide which table is the primary one. The merge keeps every column of the table you select first and adds matched columns from the second table as a nested column.
- Select the primary query in the Queries pane. On the Home tab, click Merge Queries (the icon with two overlapping tables). If you want to merge against a query that is not currently loaded as a table, use Merge Queries as New instead, which creates a separate query and leaves the originals untouched.
- In the Merge dialog, the primary table is shown in the top dropdown. Choose the second table from the bottom dropdown.
- Click the key column in the top table, then click the matching key column in the bottom table. Both get highlighted. If the column names differ, that is fine as long as the values match.
- To match on more than one column, hold Ctrl and click additional columns in the same order in both tables. Order matters: the first selected column in the top table pairs with the first selected in the bottom table.
- Choose the Join Kind from the dropdown. Left Outer keeps all rows from the first table and fills blanks where there is no match. Inner keeps only rows that exist in both. Full Outer keeps everything from both sides. Left Anti and Right Anti return only unmatched rows, which is useful for finding data quality gaps. The six options are shown as small Venn-style diagrams.
- Optionally tick the checkbox for using fuzzy matching if the keys are text with slight differences such as trailing spaces or case variations. Fuzzy matching is slower and can produce false positives, so inspect results carefully.
- Click OK. A new column appears at the end of the primary table, usually named after the second table, containing the word Table in each row.
- Click the expand icon (two arrows pointing away from each other) in the header of that new column. A checklist of the second table's columns appears.
- Untick the option to use the original column name as a prefix if you want clean field names, then tick only the columns you actually need. Click OK.
- Check the row count in the status bar at the bottom of the editor. A Left Outer merge should not change the number of rows in the primary table; if it does, your key is not unique in the second table and rows have duplicated.
- Click Close & Apply on the Home tab to load the merged result into the data model.
Common Mistakes
The most frequent problem is mismatched data types. A customer number stored as text in one table and as a whole number in the other will produce no matches at all, and every expanded column comes back null. Fix the type in both queries before merging by clicking the type icon in the column header.
Duplicate keys in the second table silently multiply rows. If the lookup table has two rows for the same product code, a Left Outer merge returns two rows for that product in the result, inflating totals in your report. Always compare row counts before and after, and check the second table for duplicates using Group By or Remove Duplicates.
Leading and trailing spaces are invisible but break matching. Use Transform > Format > Trim on both key columns first. Case differences matter in some connectors but not others, so standardise with lowercase if you are unsure.
Another common slip is expanding every column when only two or three are needed. This bloats the model and creates confusing duplicate field names. Expand selectively.
Finally, merging the wrong direction is easy to do. If you need all rows from the lookup table preserved, the lookup table must be the first selection, not the second.
Tips
Use Merge Queries as New when you are unsure of the result. It leaves both source queries intact so you can compare and delete the attempt if it goes wrong. Note that labels in the Power Query ribbon and dialog can differ slightly between Power BI Desktop versions and regions, though the merge dialog itself has been stable for a long time.
Rename the key columns to identical names in both queries before merging. It makes the dialog easier to read and your steps easier to audit later.
Keep the applied steps pane tidy. Rename steps like Merged with Products and Expanded Price so a colleague can follow the logic without opening each step.
For large tables, merge after filtering out rows you do not need. Merging a million rows against a lookup and then filtering wastes refresh time.
If you only need a single value from another table, such as a category name, consider whether a relationship in the model view would do the job instead. Merging flattens data at refresh time; relationships filter at query time. Merging is right when you need the value as a column for grouping or when the source is not in the model.
Troubleshooting
If every expanded value is null, check three things in order: data types match, keys have no hidden spaces, and the join kind is not Anti. Then preview both key columns side by side by creating a temporary query that appends them, or simply sort each column and eyeball the first few values.
If the row count jumped, look for duplicate keys in the second table. Group the second query by the key and count rows; anything above one is the culprit.
If the merge step errors with a type mismatch message, change both key columns to Text, merge, then convert the result back if needed. Text-to-text matching is the most forgiving.
If the expand icon does not appear, the column may not be recognised as a table because an earlier step changed its shape. Delete the step and redo the merge.
If refresh fails in the Power BI service but works in Desktop, check that the data source credentials are set for the gateway or cloud connection; the merge itself is not usually the cause.
Frequently Asked Questions
What is the difference between merging and appending queries?
Merging joins tables side by side by matching a key column, adding columns. Appending stacks tables on top of each other, adding rows with the same columns.
Does merging queries change my original tables?
Only if you use Merge Queries on the primary table. Merge Queries as New creates a separate query and leaves the sources untouched.
Can I merge more than two tables?
Yes. Merge two, expand the result, then merge that result with a third. Each merge is just another applied step.
Why did my row count increase after a Left Outer merge?
Because the second table has duplicate values in the key column, so one row in the first table matches several rows in the second. Remove duplicates from the lookup table first.
Should I merge in Power Query or create a relationship in the model?
Use a relationship when you only need to filter or slice by the other table. Merge when you need the other table's columns as fields in the same table, for example to build a combined category column.
Can I undo a merge?
Yes. Delete the merge step and the expand step from the Applied Steps pane. The source queries are unaffected.