Cube.PropertyKey
TableReturns the key of a property.
Syntax
Cube.PropertyKey(property as any) as anyParameters
| Name | Type | Required | Description |
|---|---|---|---|
property | any | Yes | A property value from which to extract the key. |
Return Value
any — The key identifier of the specified property.
Remarks
Cube.PropertyKey returns the key of the specified property. Properties in an Analysis Services cube have both a display name and an internal key identifier. The key is used to uniquely identify a property, especially in cases where multiple properties might share similar display names across different dimensions or hierarchies.
This function is typically used with property values obtained from Cube.Properties or Cube.MeasureProperties. The returned key can be used to programmatically reference properties in further cube operations.
Examples
Example 1: Get the key of a dimension property
let
Source = AnalysisServices.Database("localhost", "AdventureWorks"),
Cube = Source{[Name = "Adventure Works"]}[Data],
WithProduct = Cube.AddAndExpandDimensionColumn(
Cube,
{"[Product]"},
{"[Product].[Product Name]"}
),
Props = Cube.Properties(WithProduct),
FirstProp = Props{0}[Value],
Key = Cube.PropertyKey(FirstProp)
in
KeyExample 2: List property names with their keys
let
Source = AnalysisServices.Database("localhost", "AdventureWorks"),
Cube = Source{[Name = "Adventure Works"]}[Data],
WithProduct = Cube.AddAndExpandDimensionColumn(
Cube,
{"[Product]"},
{"[Product].[Product Name]"}
),
Props = Cube.Properties(WithProduct),
WithKeys = Table.AddColumn(
Props,
"Key",
each Cube.PropertyKey([Value])
)
in
WithKeysCompatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks