Sub topic 11
Appending Tables with the Same Columns
This chapter assumes you can import a table into the Power Query Editor, read the Applied Steps pane, and set data types. Appending stacks the rows of one query under the rows of another. Use it when the same kind of data arrives in separate pieces, such as one table per year.
How append works
Append matches columns by name, not by position. A column that exists in only one query still appears in the result. The other query's rows get null in that column.
Order matters only for row order and column order. The first query's columns come first.
Append in the interface
- Load both tables into Power Query, for example as queries named
Sales2024andSales2025. - On the Home tab, choose Append Queries. Choose Append Queries as New to keep the originals unchanged.
- Select Two tables, pick the first and second table, and select OK.
- Check the new query's column headers and data types.
Choose Three or more tables to stack several queries in one step.
The M code behind it
The interface writes a call to Table.Combine. It takes a list of tables.
let
Source = Table.Combine({Sales2024, Sales2025})
in
SourceTo add a third query, add its name to the list: {Sales2024, Sales2025, Sales2026}.
Common errors
| Symptom | Cause | Fix |
|---|---|---|
| A column appears twice, one mostly `null` | Headers differ, such as `Amount` and `Amount ` with a trailing space | Rename or trim the headers in the source queries before appending |
| Case mismatch creates duplicate columns | Column names are case-sensitive, so `region` and `Region` differ | Rename to one spelling |
| Combined column shows mixed or `Any` type | Sources used different types for the same column | Set the type in each source query, then again after the append |
| Rows look doubled after refresh | A source overlaps with another, for example a year loaded twice | Remove duplicates or fix the source ranges |
Check the result
After appending, confirm the row count. It should equal the sum of the row counts of the sources. In the editor, the status bar at the bottom shows the number of rows and columns for the current step.
Exercise
You append Sales2024 (columns Date, Region, Amount) and Sales2025 (columns Date, Region, Amount, Channel). What columns does the result have, and what values does Channel hold for the 2024 rows?
Show answer
The result has Date, Region, Amount, and Channel. Append matches columns by name and keeps columns that exist in only one table, so the 2024 rows get null in Channel.
Exercise
After an append, a new column named Amount appears next to Amount, with many nulls in each. What is the likely cause, and where do you fix it?
Show answer
One source has a trailing space in its header, so Power Query treats the two names as different columns. Rename the header in that source query, then check the Append step again.