Table.FromPartitions
TableCreates a table from a list of partition tables with a synthetic partition column added.
Syntax
Table.FromPartitions(partitionColumn as text, partitions as list) as tableParameters
| Name | Type | Required | Description |
|---|---|---|---|
partitionColumn | text | Yes | The name for the new column that identifies the partition each row came from. |
partitions | list | Yes | A list of {partitionValue, table} pairs, where each pair contains the partition identifier and its corresponding table. |
Return Value
table — A 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}})}
}
)Quarter | CustomerName | Product | Revenue | |
|---|---|---|---|---|
| 1 | Q1 | Alice | Widget A | 100 |
| 2 | Q1 | Bob | Gadget B | 200 |
| 3 | Q2 | Charlie | Widget C | 150 |
| 4 | Q2 | Diana | Widget A | 300 |
| 5 | Q3 | Alice | Gadget D | 250 |
| 6 | Q3 | Bob | Thingamajig E | 400 |
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
ReassembledPartitionIndex | OrderID | CustomerName | Region | |
|---|---|---|---|---|
| 1 | 0 | 2 | Bob | West |
| 2 | 0 | 4 | Diana | North |
| 3 | 1 | 1 | Alice | East |
| 4 | 1 | 3 | Charlie | East |
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"}})}
}
)Region | OrderID | CustomerName | |
|---|---|---|---|
| 1 | East | 1 | Alice |
| 2 | East | 3 | Charlie |
| 3 | West | 2 | Bob |
| 4 | West | 7 | Charlie |
| 5 | North | 4 | Alice |
| 6 | North | 8 | Diana |