Sub topic 5
How columns line up when you append
Append stacks the rows of one table under another. The harder question is which column in the second table sits under which column in the first. This chapter covers that rule, what happens when it fails, and how to prepare your queries so the result is clean.
This chapter assumes you can already append two queries from the Power Query Editor (the previous chapter) and know the basic column data types: text, number, date, and true/false.
The rule: names decide, position does not
Power Query matches columns by name. It does not look at column position. If two tables have the same columns in different orders, the append still lines them up correctly.
The match is exact:
- Case matters.
Amountandamountare different columns. - Spaces matter.
AmountandAmount(with a trailing space) are different columns. - Spelling matters.
Sales AmountandAmountare different columns, even if you know they hold the same thing.
When a name appears in only one of the tables, Power Query keeps that column and fills null for every row that came from a table without it. It does not raise an error.
A runnable example
The query below builds two small tables in code, so you can paste it into a blank query in the Advanced Editor and run it. The 2024 table has its columns in a different order and has an extra Channel column.
let
Sales_2023 = #table(
type table [Date = date, Region = text, Amount = number],
{
{#date(2023, 1, 15), "East", 120},
{#date(2023, 2, 3), "West", 85}
}
),
Sales_2024 = #table(
type table [Date = date, Amount = number, Region = text, Channel = text],
{
{#date(2024, 1, 9), 140, "East", "Online"},
{#date(2024, 1, 21), 60, "West", "Store"}
}
),
Combined = Table.Combine({Sales_2023, Sales_2024})
in
CombinedThe result has four columns and four rows:
| Date | Region | Amount | Channel |
|---|---|---|---|
| 2023-01-15 | East | 120 | null |
| 2023-02-03 | West | 85 | null |
| 2024-01-09 | East | 140 | Online |
| 2024-01-21 | West | 60 | Store |
Two things to notice:
AmountandRegionswapped positions in the 2024 table, but their values still landed in the right columns.- The column order of the result follows the first table. Columns that only appear later, such as
Channel, are added at the end in the order they are first seen.
When names almost match
The most common append problem is a near-match. Suppose the 2024 export calls the column Sales Amount. The append works, no error appears, and the result looks like this:
| Date | Region | Amount | Sales Amount |
|---|---|---|---|
| 2023-01-15 | East | 120 | null |
| 2024-01-09 | East | null | 140 |
The result now has two half-empty columns. Totals computed on Amount silently leave out the 2024 rows.
The fix is to rename the column in the 2024 query before you append. Do it as a step in Sales_2024, not in the combined query. Then the rename travels with that query wherever it is used.
let
Source = Sales_2024,
Renamed = Table.RenameColumns(
Source,
{{"Sales Amount", "Amount"}},
MissingField.Ignore
)
in
RenamedThe third argument, MissingField.Ignore, stops the step from failing if a later export no longer contains Sales Amount. Without it, a missing column produces an error on refresh. Whether you want that error depends on the situation. An error is useful if a missing column means the source is broken. Ignoring is better if the column is sometimes already named correctly.
Other near-matches to look for:
- Headers that were never promoted, which leave columns named
Column1,Column2, and so on. - Trailing or leading spaces in header text, often from CSV or copied reports.
- Different capitalization, such as
regionagainstRegion. - Language or abbreviation differences, such as
QtyagainstQuantity.
Choosing and ordering the output columns
Table.Combine takes an optional second argument: a list of column names. The result then contains only those columns, in that order. Any other column in any of the inputs is dropped.
let
Sales_2023 = #table(
type table [Date = date, Region = text, Amount = number],
{{#date(2023, 1, 15), "East", 120}}
),
Sales_2024 = #table(
type table [Date = date, Amount = number, Region = text, Channel = text],
{{#date(2024, 1, 9), 140, "East", "Online"}}
),
Combined = Table.Combine(
{Sales_2023, Sales_2024},
{"Date", "Region", "Amount"}
)
in
CombinedThis is useful when the sources carry extra columns you never want, and when you want a fixed output layout that does not change if a source adds a column later. The trade-off is that a column you forgot to list is dropped without any warning. The Append Queries dialog in the user interface does not write this argument. You add it by editing the formula in the formula bar or Advanced Editor.
Data types when columns have the same name
Matching by name does not mean matching by type. Each input column has its own data type, and the result column must hold values from both.
- If both columns have the same type, the result column keeps that type.
- If the types differ, for example
Amountis number in one table and text in the other, the result column is typedany. The values keep their own types, so one column can hold the number140and the text"140"side by side.
A column with mixed values sorts oddly, filters oddly, and fails in later steps such as a merge or a sum. The text "140" is not counted by a sum of numbers.
You have two ways to avoid this. The first is to set the types in each source query before you append. This is the safer choice, because each source is converted with knowledge of its own format. The second is to set the types once after the append:
let
Source = Table.Combine({Sales_2023, Sales_2024}),
Typed = Table.TransformColumnTypes(
Source,
{{"Date", type date}, {"Amount", type number}}
)
in
TypedConverting after the append is simpler, but one bad value in either source can then raise a cell-level error in the combined column. Dates and decimal numbers written as text depend on the locale of your Excel and of the source. A text value such as "1.200" converts to a different number in different locales. If your sources come from different regions, convert each source separately and pass a culture to Table.TransformColumnTypes as the third argument.
Common failure modes
| Symptom | Likely cause | Fix |
|---|---|---|
| Two columns that look like one, each half null | Header names differ in spelling, case, or spaces | Rename in the source query before appending |
| New column full of null in old rows | A column exists only in newer sources | Expected. Replace nulls if needed, or list columns explicitly |
| Column with the `ABC123` icon | Mixed types across inputs | Convert types in each source, then append |
| Columns named `Column1`, `Column2` | First row not promoted to headers | Add a Promote Headers step in that source |
| Refresh error "column not found" | A rename or select step names a column that disappeared | Use `MissingField.Ignore`, or fix the source |
Checklist before you append
- Open each input query and confirm the header row is promoted.
- Write down the column names in each query and compare them character by character, including case and spaces.
- Rename or remove columns in the individual queries so names agree.
- Set data types in each query.
- Append, then check the column count, the null counts per column, and the type icons.
Exercise
Table A has columns Date, Region, Amount. Table B has columns Date, area, amount, Channel. You append B to A with Table.Combine and no column list. What columns does the result have, in what order, and what do you change so the result has only Date, Region, Amount, and Channel?
Show answer
The result has six columns: Date, Region, Amount, area, amount, Channel. Date is the only name that matches, because matching is exact and case-sensitive. Region and area, and Amount and amount, are separate columns, and each is null for rows from the other table. The fix is to rename area to Region and amount to Amount in table B's query before appending. For example, use Table.RenameColumns(B, {{"area", "Region"}, {"amount", "Amount"}}). After that the result has Date, Region, Amount, Channel, with Channel null for rows from table A.
Exercise
Your append result has an Amount column whose type icon is ABC123 and a sum of the column returns less than you expect. What is the likely cause, and where should you fix it?
Show answer
The Amount columns have different data types in the input queries, probably number in one and text in the other. The result column is typed any and holds both, and the sum skips the text values. Set Amount to type number in the query that has it as text, before the append, so that both inputs have the same type.