Cube.AttributeMemberId
TableReturns the unique member identifier from a dimension attribute member property value.
Syntax
Cube.AttributeMemberId(attribute as any) as anyParameters
| Name | Type | Required | Description |
|---|---|---|---|
attribute | any | Yes | A dimension attribute member property value from which to extract the unique member identifier. |
Return Value
any — The 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
MemberIdExample 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