Table.ReplacePartitionKey
TableReplaces the partition key of the specified table.
Syntax
Table.ReplacePartitionKey(table as table, partitionKey as nullable list) as tableParameters
| Name | Type | Required | Description |
|---|---|---|---|
table | table | Yes | The table whose partition key to replace. |
partitionKey | list | No | A list of column names to set as the new partition key, or null to clear the partition key. |
Return Value
table — A table with the partition key replaced by the specified column list.
Remarks
Table.ReplacePartitionKey sets or replaces the partition key metadata on a table. The partition key is a list of column names that define how the table's data is logically segmented. Pass null to clear an existing partition key.
This is the setter counterpart to Table.PartitionKey. Partition keys are primarily used by custom connectors and the Power Query engine to enable parallel evaluation of partitioned data sources.
Examples
Example 1: Set a partition key on a table
let
Partitioned = Table.ReplacePartitionKey(Sales, {"Category"}),
Key = Table.PartitionKey(Partitioned)
in
KeyCompatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks