0
0
Power-biHow-ToBeginner ยท 3 min read

How to Append Queries in Power BI: Step-by-Step Guide

In Power BI, you can append queries by opening the Power Query Editor, then using the Append Queries option to combine two or more tables vertically. This merges rows from multiple queries into one, keeping all columns aligned by name.
๐Ÿ“

Syntax

The Append Queries feature in Power BI does not use code but a user interface in Power Query Editor. The basic steps are:

  • Home > Append Queries or Append Queries as New
  • Select two or more tables to combine
  • Confirm to create a new appended query or overwrite an existing one

This operation stacks tables vertically, adding rows from the second table below the first.

๐Ÿ’ป

Example

This example shows how to append two simple tables in Power Query M code, which is the language behind Power BI queries.

Table1 has sales data for January, Table2 for February. Appending combines them into one table with all sales.

powerquery
let
    Table1 = Table.FromRecords({[Product="Apple", Sales=100], [Product="Banana", Sales=150]}),
    Table2 = Table.FromRecords({[Product="Apple", Sales=120], [Product="Banana", Sales=130]}),
    AppendedTable = Table.Combine({Table1, Table2})
in
    AppendedTable
Output
Product | Sales --------|------- Apple | 100 Banana | 150 Apple | 120 Banana | 130
โš ๏ธ

Common Pitfalls

Common mistakes when appending queries include:

  • Appending tables with different column names causes missing or misaligned data.
  • Appending queries with different data types in the same column can cause errors.
  • Using Append Queries instead of Append Queries as New may overwrite original data unintentionally.

Always check column names and data types before appending.

powerquery
/* Wrong: Different column names cause missing data */
let
    Table1 = Table.FromRecords({[Product="Apple", Sales=100]}),
    Table2 = Table.FromRecords({[Item="Apple", Amount=120]}),
    Appended = Table.Combine({Table1, Table2})
in
    Appended

/* Right: Rename columns to match before appending */
let
    Table1 = Table.FromRecords({[Product="Apple", Sales=100]}),
    Table2 = Table.FromRecords({[Item="Apple", Amount=120]}),
    Table2Renamed = Table.RenameColumns(Table2,{{"Item", "Product"}, {"Amount", "Sales"}}),
    Appended = Table.Combine({Table1, Table2Renamed})
in
    Appended
๐Ÿ“Š

Quick Reference

StepDescription
Open Power Query EditorGo to Home > Transform Data
Select Append QueriesChoose Append Queries or Append Queries as New
Choose TablesSelect two or more tables to append
ConfirmClick OK to create appended query
Check ColumnsEnsure columns match in name and type
โœ…

Key Takeaways

Use Append Queries in Power Query Editor to combine tables vertically.
Ensure column names and data types match before appending to avoid errors.
Use Append Queries as New to keep original queries intact.
Appending stacks rows from multiple tables into one combined table.
Power Query M code uses Table.Combine to append tables programmatically.