skip to content

In Power Query, how does Merge Queries differ from Append Queries?

level: juniorimportance: must knowfreq 70%

answer

  1. one makes it wider, one makes it taller
  2. think JOIN versus UNION ALL
  3. keys on one side, column names on the other
  4. left anti is the find-the-orphans join

basics

~20 s

Merge Queries joins two Power Query queries side by side on matching key columns, producing a wider table. Append Queries stacks their rows, producing a taller table. Merge is a SQL-style join; Append behaves like UNION ALL.

solid answer

~40 s

They combine in perpendicular directions. **Merge Queries** matches rows in the current query against rows in another query on one or more key columns and brings that other query's columns in — the result is wider. It offers left outer, right outer, full outer, inner, left anti and right anti joins, and it writes two M steps: `Table.NestedJoin`, which parks the matching rows in a nested table column, then `Table.ExpandTableColumn`, which flattens the columns you pick. If the right side has several matches per key, expanding multiplies your rows. **Append Queries** stacks the rows of two or more queries with `Table.Combine`, matching columns *by name*; a column present in only one query fills with null for the other's rows. Append does not de-duplicate — identical rows in both queries appear twice.

go deeper

for a junior

Be ready to say instantly which command adds columns and which adds rows, and to name the join kinds Merge offers, including the anti joins.

for a middle

Explain the two M steps a merge writes, why expanding a one-to-many merge multiplies rows, and that Append matches columns by name and never removes duplicates.

for a senior

Show judgment about whether the merge belongs in Power Query at all rather than as a model relationship, and know when a merge or append still folds back to the source.

for a principal

Own the team guidance: which joins belong upstream in the warehouse so every report inherits them, and which shaping is genuinely local to one report.

## The two directions of combining Power Query is the data-preparation engine inside Power BI Desktop (also in Excel and in Fabric dataflows). A query is a list of Applied Steps written in the M language, each transforming the table the previous step produced. Two of those steps combine the current query with another query, and they combine along perpendicular axes. **Merge Queries** combines *horizontally*. It matches rows of the current query against rows of another query using one or more key columns, and the result has the original columns plus columns brought in from the other query. The table gets wider; the row count stays the same only if every key matches at most one row on the other side. **Append Queries** combines *vertically*. It puts the rows of the second query underneath the rows of the first. The table gets taller; the column list is the union of both column lists. The SQL analogy is exact enough to reason with: Merge is `JOIN`, Append is `UNION ALL`. Note the `ALL` — Append performs no de-duplication whatsoever. If the same invoice row exists in both source queries, you load it twice, and the model will happily double-count it. ## What Merge actually writes Merging generates two M steps, and understanding the pair explains most merge surprises: 1. `Table.NestedJoin(Left, {"CustomerID"}, Right, {"CustomerID"}, "Right", JoinKind.LeftOuter)` adds one new column whose every cell holds a *table* — the rows from the right query that matched that key. 2. `Table.ExpandTableColumn(...)` flattens the chosen columns out of that nested table. Because the intermediate shape is nested, expanding a one-to-many merge multiplies rows: if a customer has three matching orders, that one customer row becomes three after expansion. This is the single most common "my row count exploded" report, and it is not a bug — it is what a join does. Merge offers six join kinds. Left Outer keeps all rows of the first query and adds matches from the second; Inner keeps only matched rows; Full Outer keeps everything; Right Outer mirrors Left Outer. **Left Anti** returns only the rows of the first query with *no* match in the second — the standard tool for answering "which of my fact rows have no dimension entry?" Right Anti is the mirror. There is also a fuzzy-matching option that matches approximate text with a configurable similarity threshold, useful for dirty name data and dangerous everywhere else. Key matching compares both value and type: a text `"1001"` does not match a numeric `1001`, and text comparison is case-sensitive by default, so `"ACME"` and `"Acme"` are different keys. Trim, clean and set types on both sides before merging. ## What Append actually does Append generates `Table.Combine({Query1, Query2})` and matches columns **by name, case-sensitively** — never by position. A column that exists in only one of the queries appears in the result with nulls for the rows that came from the query lacking it. That is usually what you want when appending twelve monthly files, and it is a quiet trap when one file's header says `Amount` and another says `amount`: you get two columns, each half full. Append can take more than two queries in one step, which is cleaner than chaining pairs. When the same column carries different types in the two queries, the appended column often widens to `any`, and you should set the type explicitly afterwards. ## Folding and source boundaries When both queries read from the same foldable source — two tables in the same SQL Server database over one connection — Power Query can usually translate the merge into a SQL `JOIN` and the append into a `UNION ALL`, so the server does the work. Combining across *different* sources (a SQL table and an Excel file) cannot fold: rows are pulled into the local mashup engine, and Power Query's privacy-level rules also come into play for how those sources may be combined. ## Choosing between them, and choosing neither Same shape, different slices — this year's file plus last year's file, one query per region — is an Append. Extra attributes for rows you already have is a Merge. But in Power BI, before merging, ask whether you need the merge at all: pulling product name and category into the sales table with a Merge widens the fact table, and the model normally wants the product table loaded separately with a relationship to the fact table instead. Merge is for the cases where the lookup genuinely belongs in the row — resolving a key, or attaching a value the model cannot reach by relationship.

  • What happens to the row count when you expand a merge whose right query has several rows per key?
    The row multiplies. `Table.NestedJoin` parks all matching rows in a nested table cell, and `Table.ExpandTableColumn` turns each of those matches into its own row — three matching orders turn one customer row into three. If you only wanted an attribute, either aggregate the nested table before expanding, or merge against a query that is unique on the key.
  • Why does appending twelve monthly CSVs sometimes produce duplicate-looking columns?
    Append matches columns by name, case-sensitively. If one file's header reads `Amount` and another reads `amount` or ` Amount` with a leading space, Power Query treats them as two different columns and each ends up half populated with nulls. Normalise headers in each query — or in a shared transform function — before appending.
  • When would you use a Left Anti join in Power Query?
    To find rows that have no counterpart: fact rows whose product key is missing from the product query, customers who placed no orders, files not yet processed. It returns the first query's rows with no match in the second, which makes it a quick data-quality check you can load as its own exception table.

Merge is taping two sheets of paper edge to edge so the rows line up; Append is putting one sheet on top of the other in the same tray.

saying these in an interview costs you the question

  • Says Append de-duplicates rows the way UNION does
  • Assumes Append matches columns by position rather than name
  • Expects a text key to match a numeric key in a Merge
  • Uses Merge to flatten dimensions instead of a model relationship
  • Cannot name a join kind other than inner and left outer

context