Cube.AttributeMemberId

Table

Returns the unique member identifier from a dimension attribute member property value.

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

Syntax

Cube.AttributeMemberId(attribute as any) as any

Parameters

NameTypeRequiredDescription
attributeanyYesA dimension attribute member property value from which to extract the unique member identifier.

Return Value

anyThe unique member identifier for the given attribute member property value, or null if the value is not a member property.

Remarks

Cube.AttributeMemberId extracts the unique member identifier from a member property value returned by a dimension attribute column. In Analysis Services, each member in a dimension hierarchy has a unique identifier (often in the format [Dimension].[Hierarchy].&[Key]). This function retrieves that identifier from attribute values in the cube's tabular view.

The function returns null for values that are not member property values (i.e., values that did not originate from a cube dimension attribute).

This is useful when you need to reference a specific member programmatically -- for example, to build MDX expressions or to match members across different dimensions or hierarchies.

Examples

Example 1: Get the member ID from a product attribute

let
    Source = AnalysisServices.Database("localhost", "AdventureWorks"),
    Cube = Source{[Name = "Adventure Works"]}[Data],
    WithProduct = Cube.AddAndExpandDimensionColumn(
        Cube,
        {"[Product]"},
        {"[Product].[Product Name]"}
    ),
    FirstRow = Table.First(WithProduct),
    MemberId = Cube.AttributeMemberId(FirstRow[Product Name])
in
    MemberId

Example 2: Compare member IDs

let
    Source = AnalysisServices.Database("localhost", "AdventureWorks"),
    Cube = Source{[Name = "Adventure Works"]}[Data],
    WithProduct = Cube.AddAndExpandDimensionColumn(
        Cube,
        {"[Product]"},
        {"[Product].[Product Name]"}
    ),
    AddMemberId = Table.AddColumn(
        WithProduct,
        "MemberId",
        each Cube.AttributeMemberId([Product Name]),
        type text
    )
in
    AddMemberId

Compatibility

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