Power BI Course
Appending and Merging Queries
Most real-world Power BI projects pull data from more than one table. Append stacks tables on top of each other — rows from one table added below rows from another. Merge joins tables side by side — columns from one table brought into another based on a matching key. These are Power Query's equivalents of SQL UNION ALL and JOIN. Knowing which operation to use, and which join type to choose, prevents the most common data modelling errors beginners make.
Append vs Merge — The Core Difference
Append Queries
Append is used whenever you have multiple tables with the same structure that should be treated as one. The most common scenario is monthly or regional data files — January sales, February sales, March sales — that all have identical columns and need to be combined into a single annual table for analysis.
| Option | When to use it |
|---|---|
| Append Queries | Modifies the currently selected query by adding rows from the second table at the bottom. The primary query grows. Use when you want the result to replace the primary query. |
| Append Queries as New | Creates a brand new query containing the appended result. Both original queries remain untouched. Use this — it preserves the originals and the result is a separate named query you can work with independently. |
What Happens When Column Names Do Not Match
Append matches columns by name, not by position. If Sales_Q1 has a column called "Revenue" and Sales_Q2 calls it "Sales", Append does not combine them — it creates two separate columns in the result, with nulls wherever a row comes from a table that does not have that column name.
| OrderID | Revenue | Sales |
|---|---|---|
| 1001 | 1,200 | null |
| 1002 | 850 | null |
| 1003 | null | 430 |
| 1004 | null | 95 |
Merge Queries — Joining Two Tables
Merge is the equivalent of a SQL JOIN. It takes a key column from each of two tables, finds matching rows, and brings selected columns from the second table into the first. The result has all the columns of the primary table plus any columns you choose to expand from the second table.
| OrderID | CustomerID ← | Revenue |
|---|---|---|
| 1001 | C101 | 1,200 |
| 1002 | C102 | 850 |
| CustomerID ← | CustomerName | City |
|---|---|---|
| C101 | Alice Brown | Austin |
| C102 | Bob Singh | Denver |
The Six Join Types
Power Query offers six join types. Choosing the wrong one silently produces the wrong number of rows — and the error is often not obvious until a total looks wrong in a visual. Understanding what each join type keeps and discards is essential.
Expanding the Merged Column
After a Merge step, the second table's data appears as a single column containing nested table objects — not as separate columns yet. You must expand this column to choose which fields to bring in. This step is what most beginners miss.
| OrderID | CustomerID | Revenue |
Customers
⇔ Expand
|
|---|---|---|---|
| 1001 | C101 | 1,200 | Table |
| 1002 | C102 | 850 | Table |
Full Merge + Expand sequence in M code:
// Step 1 — Merge Orders with Customers on CustomerID
#"Merged Queries" = Table.NestedJoin(
Orders, // primary table
{"CustomerID"}, // key column in Orders
Customers, // second table
{"CustomerID"}, // key column in Customers
"Customers", // name for the nested table column
JoinKind.LeftOuter
),
// Step 2 — Expand the nested Customers column
// Choose which columns from Customers to bring in
#"Expanded Customers" = Table.ExpandTableColumn(
#"Merged Queries",
"Customers",
{"CustomerName", "City"}, // columns to expand
{"CustomerName", "City"} // names for the new columns
)
| OrderID | CustomerID | Revenue | CustomerName | City |
|---|---|---|---|---|
| 1001 | C101 | 1,200 | Alice Brown | Austin |
| 1002 | C102 | 850 | Bob Singh | Denver |
| 1003 | C103 | 430 | Carol Lee | Seattle |
| 1004 | C999 | 95 | null | null |
Merge vs Model Relationships — Which to Use
You can bring customer name into your Orders table in Power Query using Merge, or you can leave the tables separate and create a relationship in the model. Both produce the same result in visuals, but they have very different implications for file size, flexibility, and maintenance.
| Merge in Power Query | Relationship in Model View | |
|---|---|---|
| Model size | Customer columns are duplicated into every row of the Orders table — increases file size proportionally. | Data stored once in Customers table. Orders only stores the CustomerID key. Much smaller model. |
| Slicer filtering | Works — the merged column is in the Orders table and can be filtered. | Works — relationship propagates filter from Customers to Orders automatically. |
| Customer changes | If a customer's name changes in the source, the merged value in Orders only updates on the next refresh — and only reflects the state at refresh time. | Customers table is independent. Updates to customer data are reflected everywhere automatically through the relationship. |
| Recommended? | Avoid for dimensions — use only for lookup data that is genuinely flat and will not grow. | Always preferred for dimension tables — smaller, cleaner, more flexible. |
Teacher's Note: The most important rule is this — use Append freely, use Merge with caution. Append is almost always the right tool when combining files with the same structure. Merge in Power Query should be reserved for cases where you genuinely need a flat denormalised table for a specific purpose — like preparing data for export or feeding a specific visual that cannot use relationships. For everything else, build the relationship in Model View instead. Your model will be smaller, faster, and easier to maintain.
Practice
Practice 1 of 3
You have three monthly sales files — Jan, Feb, and Mar — all with identical columns. To combine them into one table while keeping all three original queries intact, you use Home → Append Queries as ___ in the Power Query Editor.
Practice 2 of 3
After a Merge step, the second table's data appears as a single column showing the word "Table" in every row. To convert this into actual columns, you click the ___ icon in that column's header.
Practice 3 of 3
You want to find all orders in the Orders table that have a CustomerID with no matching record in the Customers table — a data quality check. The correct join type to use in Merge is Left ___.
Lesson Quiz
Quiz 1 of 3
You append Sales_Q1 (1,240 rows) and Sales_Q2 (1,180 rows). The result has 2,420 rows but the Revenue column shows many nulls. What is the most likely cause?
Quiz 2 of 3
You merge Orders with Customers using Left Outer join on CustomerID. The Orders table has 500 rows. After the merge and expand, the result has 620 rows. What happened?
Quiz 3 of 3
A colleague merged the Orders and Customers tables in Power Query to bring CustomerName into Orders, then deleted the Customers query. Six months later the business changes 200 customer names in the source. What problem will occur on the next refresh?
Next up — Lesson 23 covers Advanced Cleaning Techniques — handling errors in cells, replacing null values, standardising inconsistent text, and building robust cleaning steps that do not break when the source data is messy in unexpected ways.