Sub topic 5
How columns line up when you append
This chapter assumes you can load tables into the Power Query Editor, know basic data types (text, number, date), and have already appended two queries with Home > Append Queries. Here you will see how Power Query decides which columns belong together, and what goes wrong when it guesses differently than you expect.
Columns match by name, not position
Append matches columns by header name. The order of columns in each table does not matter. A column called Amount in the second table lands under Amount in the first, even if it sits in a different position.
The match is exact. It is case-sensitive and sensitive to spaces. Amount, amount, and Amount (with a trailing space) are three different columns.
let
Source = Table.Combine({Sales_2023, Sales_2024})
in
SourceTable.Combine is the function behind Append Queries. It builds the result from the union of all column names found in the listed tables.
What happens to columns that exist in only one table
If a column appears in only one table, the result still includes it. The rows from the other table get null in that column.
Suppose Sales_2023 has Date, Product, Amount, and Sales_2024 has Date, Product, Amount, Channel.
| Source table | Date | Product | Amount | Channel |
|---|---|---|---|---|
| Sales_2023 | 2023-03-01 | Desk | 400 | null |
| Sales_2024 | 2024-02-10 | Chair | 150 | Online |
The most common cause of unexpected nulls is not a genuinely new column. It is a renamed column, such as Amount in one file and Total in the other. Append then produces two columns, each half empty.
Fixing mismatched names
Rename the column in the source query before you append, so both queries use the same header. Do this in the query that has the wrong name, not in the appended result. If you rename after the append, you have to merge two columns by hand.
Check the result by looking for columns that are mostly null, or for column names you did not expect.
Data types when appending
Append does not convert values to make them agree. When the same column has different types in the two tables, the result column takes the type from the first table, or becomes any when the types are not compatible. Values that cannot be read as the chosen type may turn into errors in a later step.
Typical cases:
- Number in one table, text in the other. The column can end up as
anyand sort as text, so100sorts before20. - Date in one table, text in the other. Date filters then skip the text rows.
Set the data type of each column in each source query before appending. Then set the types once more on the result if the final step needs them.
let
Source = Table.Combine({Sales_2023, Sales_2024}),
Typed = Table.TransformColumnTypes(Source, {{"Date", type date}, {"Amount", type number}})
in
TypedThe order of tables sets the column order
The result lists the columns of the first table first. New columns from later tables are added on the right. If you want a specific column order, add a Choose Columns or Reorder Columns step after the append.
Exercise
You append Sales_2023 (columns Date, Product, Amount) and Sales_2024 (columns Date, Product, Total). The result has five columns, and Amount and Total are each half null. What caused this and how do you fix it?
Show answer
Append matches columns by exact name, so Amount and Total were treated as different columns. Rename Total to Amount in the Sales_2024 query (or the other way around), then refresh the appended query. The result will then have three columns with no unexpected nulls.