Table.PartitionKey

Table

Returns the partition key of the specified table.

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

Syntax

Table.PartitionKey(table as table) as nullable list

Parameters

NameTypeRequiredDescription
tabletableYesThe table whose partition key to retrieve.

Return Value

listA list of column names that form the partition key, or null if no partition key is defined.

Remarks

Table.PartitionKey returns the partition key metadata attached to a table as a list of column names, or null if no partition key has been defined. Partition keys indicate how a table's data is physically or logically segmented — for example, by date or region.

This is the getter counterpart to Table.ReplacePartitionKey. Use Table.PartitionValues to see the actual partition segments.

Partition keys are primarily relevant when working with partitioned data sources or building custom connectors that expose partitioned data to the Power Query engine for parallel evaluation.

Examples

Example 1: Check whether a table has a partition key

let
    Source = Sales,
    Key = Table.PartitionKey(Source)
in
    if Key = null then "No partition key" else Text.Combine(Key, ", ")

Compatibility

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