Table.Partition
TablePartitions a table into a list of tables using a hash function on a specified column.
Syntax
Table.Partition(table as table, column as text, groups as number, seed as number) as listParameters
| Name | Type | Required | Description |
|---|---|---|---|
table | table | Yes | The table to partition. |
column | text | Yes | The column whose values are hashed to assign rows to partitions. |
groups | number | Yes | The number of partitions (output tables) to create. |
seed | number | Yes | A seed value for the hash function, affecting how rows are distributed. |
Return Value
list — A list of tables, where each table is a partition of the original.
Remarks
Table.Partition distributes rows from a table into a list of groups sub-tables using a hash function applied to the specified column. Each row is assigned to exactly one partition based on a hash of its column value, modulo the number of groups. Every row in the original table appears in exactly one partition — no rows are dropped or duplicated.
The seed parameter influences the hash function and changes how rows are distributed across partitions. Changing seed with the same data and groups count may yield a different distribution. Partitioning is primarily used for parallel or chunked processing — for example, processing a large table in N independent batches, or distributing work across multiple calls.
Table.Partition is the counterpart of Table.FromPartitions — use Table.FromPartitions to reassemble partitioned tables back into one. For splitting a table into sequential pages by row count, use Table.Split instead.
Examples
Example 1: Partition 8 Sales rows into 3 buckets
let
Sales = #table(
{"OrderID", "CustomerName", "Product", "Region"},
{{1,"Alice","Widget A","East"},{2,"Bob","Gadget B","West"},{3,"Charlie","Widget C","East"},
{4,"Alice","Gadget D","North"},{5,"Diana","Widget A","West"},{6,"Bob","Thingamajig E","East"},
{7,"Charlie","Gadget B","West"},{8,"Diana","Widget C","North"}}
),
Partitions = Table.Partition(Sales, "OrderID", 3, 0)
in
List.Count(Partitions)Result | |
|---|---|
| 1 | 3 |
Example 2: Access and count rows in each partition
let
Sales = #table(
{"OrderID", "CustomerName"},
{{1,"Alice"},{2,"Bob"},{3,"Charlie"},{4,"Alice"},{5,"Diana"},{6,"Bob"},{7,"Charlie"},{8,"Diana"}}
),
Partitions = Table.Partition(Sales, "OrderID", 2, 0),
Counts = List.Transform(Partitions, Table.RowCount)
in
CountsResult | |
|---|---|
| 1 | {4, 4} |
Example 3: Process each partition independently and recombine
let
Employees = #table(
type table [EmployeeID = text, FullName = text, Salary = number],
{{"E001","alice smith",55000},{"E002","BOB JONES",95000},{"E003","Charlie Brown",72000},
{"E004","diana PRINCE",68000},{"E005","Eve Martinez",88000},{"E006","frank lee",52000}}
),
Partitions = Table.Partition(Employees, "EmployeeID", 2, 0),
Processed = List.Transform(Partitions, each Table.AddColumn(_, "Bonus", each [Salary] * 0.10, type number)),
Combined = Table.Combine(Processed)
in
CombinedEmployeeID | FullName | Salary | Bonus | |
|---|---|---|---|---|
| 1 | E002 | BOB JONES | 95,000 | 9,500 |
| 2 | E004 | diana PRINCE | 68,000 | 6,800 |
| 3 | E006 | frank lee | 52,000 | 5,200 |
| 4 | E001 | alice smith | 55,000 | 5,500 |
| 5 | E003 | Charlie Brown | 72,000 | 7,200 |
| 6 | E005 | Eve Martinez | 88,000 | 8,800 |