Table.FromPartitions

Table

Creates a table from a list of partition tables with a synthetic partition column added.

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

Table.FromPartitions(partitionColumn as text, partitions as list) as table

Parameters

NameTypeRequiredDescription
partitionColumntextYesThe name for the new column that identifies the partition each row came from.
partitionslistYesA list of {partitionValue, table} pairs, where each pair contains the partition identifier and its corresponding table.

Return Value

tableA combined table with all partition rows and a new column identifying which partition each row came from.

Remarks

Table.FromPartitions combines multiple labeled sub-tables into a single table, adding a new column that records which partition each row came from. Each element in the partitions list is a two-element list of the form {partitionValue, table}. The partition column is prepended to the result.

This function is the logical inverse of Table.Partition — use Table.Partition to split one table into a list of sub-tables, and Table.FromPartitions to reassemble them. It is also useful for assembling a union of independently loaded or processed datasets where you want to preserve a label indicating the data's origin (e.g., year, month, region, or file name).

All partition tables should share the same schema. If the schemas differ, column values for missing fields will be null. The partitionColumn name must not conflict with any existing column name in the partition tables.

Examples

Example 1: Combine quarterly sales into a single labeled table

Table.FromPartitions(
    "Quarter",
    {
        {"Q1", #table({"CustomerName", "Product", "Revenue"}, {{"Alice","Widget A",100},{"Bob","Gadget B",200}})},
        {"Q2", #table({"CustomerName", "Product", "Revenue"}, {{"Charlie","Widget C",150},{"Diana","Widget A",300}})},
        {"Q3", #table({"CustomerName", "Product", "Revenue"}, {{"Alice","Gadget D",250},{"Bob","Thingamajig E",400}})}
    }
)
Result
Quarter
CustomerName
Product
Revenue
1Q1AliceWidget A100
2Q1BobGadget B200
3Q2CharlieWidget C150
4Q2DianaWidget A300
5Q3AliceGadget D250
6Q3BobThingamajig E400

Example 2: Reassemble tables produced by Table.Partition

let
    Sales = #table(
        {"OrderID", "CustomerName", "Region"},
        {{1,"Alice","East"},{2,"Bob","West"},{3,"Charlie","East"},{4,"Diana","North"}}
    ),
    Partitions = Table.Partition(Sales, "OrderID", 2, 0),
    Reassembled = Table.FromPartitions(
        "PartitionIndex",
        List.Transform({0..List.Count(Partitions)-1}, each {_, Partitions{_}})
    )
in
    Reassembled
Result
PartitionIndex
OrderID
CustomerName
Region
102BobWest
204DianaNorth
311AliceEast
413CharlieEast

Example 3: Build a labeled union from separate region datasets

Table.FromPartitions(
    "Region",
    {
        {"East",  #table({"OrderID","CustomerName"}, {{1,"Alice"},{3,"Charlie"}})},
        {"West",  #table({"OrderID","CustomerName"}, {{2,"Bob"},{7,"Charlie"}})},
        {"North", #table({"OrderID","CustomerName"}, {{4,"Alice"},{8,"Diana"}})}
    }
)
Result
Region
OrderID
CustomerName
1East1Alice
2East3Charlie
3West2Bob
4West7Charlie
5North4Alice
6North8Diana

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks