Power Query: Merging and Appending Queries
Two ways to combine data in Power Query: append (stacking rows) and merge (joining on a key). Both replace common Excel patterns — copy-paste for append, VLOOKUP for merge — with something refreshable, transparent, and reliable at scale.
Append vs. merge
| Operation | What it does | When to use |
|---|---|---|
| Append | Stacks rows of one query beneath another | Combining monthly extracts, multi-file logs, historic + current data |
| Merge | Joins two queries side-by-side on a matching column | Adding lookup values (like VLOOKUP), joining orders with customers |
Appending queries
The basic operation
Two flavors:
- Append Queries — adds the appended data to the current query as a new step
- Append Queries as New — creates a new query with the combined data, leaving originals untouched
Column alignment
Power Query matches columns by name. If both queries have "Region", they combine into one Region column. If one has "Region" and the other has "region" (different case), Power Query treats them as different columns — the result has both.
"Amount" in one query and "amount" in another produces two columns, each half-filled with nulls. Standardize column names in each query before appending.
Appending three or more queries
In the Append dialog, choose "Three or more tables". Select each query to include. The output stacks them all.
Appending all files in a folder
The classic use case. Don't manually append one query per month:
- Data → Get Data → From File → From Folder
- Combine & Transform Data
- Pick the sheet/table to combine
Power Query builds a small "combine" pipeline that reads each file and appends. New files in the folder appear on refresh.
Adding a source-file column
When combining from a folder, Power Query adds a "Source.Name" column showing which file each row came from. Useful for auditing. Keep it or remove it depending on your needs.
Merging queries
The basic operation
The Merge dialog
- Select the current query's matching column (click the header)
- Pick the second query from the dropdown
- Select the second query's matching column
- Choose join kind (see below)
- OK
A new column appears — a nested table icon. Click the expand icon (top-right of the new column) to select which fields from the second query to bring in.
Join kinds
| Join | Result | SQL equivalent |
|---|---|---|
| Left Outer (default) | All rows from first query. Matched rows include second query's fields; unmatched show null. | LEFT JOIN |
| Right Outer | All rows from second query. Matched rows include first; unmatched show null. | RIGHT JOIN |
| Full Outer | All rows from both queries. Nulls where no match. | FULL OUTER JOIN |
| Inner | Only matched rows. | INNER JOIN |
| Left Anti | Rows in first query with no match in second. | LEFT ANTI (WHERE NOT EXISTS) |
| Right Anti | Rows in second query with no match in first. | RIGHT ANTI |
The most useful non-default join. Merge Orders (left) with Shipped Orders (right) using Left Anti. Result: orders that haven't shipped yet. Cleaner than filtering after a VLOOKUP with #N/A checks.
Merging on multiple columns
Ctrl+click multiple columns in the first query, then Ctrl+click matching columns in the second (in the same order). The merge uses all selected columns as a composite key.
Expanding the merged column
After merging, the second query appears as a single column labeled with the query name. Click the expand icon at the top-right of the column header:
- Choose which fields to expand
- Uncheck "Use original column name as prefix" for cleaner column names (or leave it on to prevent naming collisions)
Merging vs. VLOOKUP
| Feature | VLOOKUP | Merge |
|---|---|---|
| Refresh | Recalculates when workbook opens | Refreshes with the query |
| Multiple lookup columns | Complex helper columns needed | Native support |
| Non-matching rows | Returns #N/A | Handled cleanly by join kind |
| Performance on large data | Slow with 100k+ rows | Fast — batch operation |
| Multiple columns from lookup | Multiple VLOOKUP formulas | Expand once, get everything |
Common patterns
Monthly consolidation
Each month, a new sales file drops into a folder. The consolidated report:
- From Folder → Combine & Transform
- Clean columns (types, headers)
- Merge with Products table for category/family info
- Load to Table or Data Model
Drop next month's file → Refresh → dashboard updates.
Finding orphan records
Orders that reference a product ID that doesn't exist in the Products table:
- Merge Orders (left) with Products (right) on ProductID
- Change join kind to Left Anti
- Result: order rows with no matching product
Combining historic and current data
- Load Historic sales (2020-2024) as one query
- Load Current sales (2025+) as another query
- Append Queries as New → "All Sales"
- Load "All Sales" to the model
Common pitfalls
Extra spaces, different capitalization, or trailing punctuation cause merges to miss matches. Trim and standardize both key columns before merging.
If the right query has duplicate keys, the merge multiplies rows in the left query. Ensure the join key is unique on the right side, or use Group By to aggregate before merging.
If Column A is numeric in one query and text in another, the appended column is text. Set consistent types in each query before appending.
You don't need every intermediate query loaded to a sheet. Set them to Connection Only (Close & Load To → Only Create Connection) and add to Data Model if needed. Keeps the workbook clean.