Cube.AttributeMemberId

Cube.AttributeMemberId

D

The M Code Behind the Power Query M function Cube.AttributeMemberId

One such function is the Cube.AttributeMemberId function. Let’s take a closer look at the M code behind this function and how it can be used to work with multidimensional data.

What is Cube.AttributeMemberId Function?

The Cube.AttributeMemberId function is used to retrieve a unique identifier for a member of a specified attribute hierarchy. This function requires two arguments: the first argument is the name of the attribute hierarchy, and the second argument is the member name.

Here’s the syntax of the Cube.AttributeMemberId function:


Cube.AttributeMemberId(attributeHierarchyName, memberName)


The function returns a unique identifier for the specified member. This unique identifier is useful when you need to reference a specific member in a measure or calculation.

How to Use Cube.AttributeMemberId Function

Let's take a look at an example of how to use the Cube.AttributeMemberId function.

Suppose we have a multidimensional data source that contains a Sales cube with a Date dimension and a Product dimension. The Product dimension has an attribute hierarchy called Product Category, which has the following members:

- Beverages

- Dairy

- Snacks

- Baked Goods

Suppose we want to retrieve the Sales data for the Snacks category only. We can use the Cube.AttributeMemberId function to retrieve the unique identifier for the Snacks member as follows:


Cube.AttributeMemberId(“Product Category”, “Snacks”)


This function will return a unique identifier for the Snacks member of the Product Category attribute hierarchy. We can then use this unique identifier in a measure or calculation to retrieve Sales data for the Snacks category.

The Cube.AttributeMemberId function is a powerful tool for working with multidimensional data in Power Query. It allows you to retrieve a unique identifier for a member of a specified attribute hierarchy, which can be useful when you need to reference a specific member in a measure or calculation. By understanding the M code behind this function, you can unlock its full potential and take your data transformation and analysis to the next level.

Power Query and M Training Courses by G Com Solutions (0800 998 9248)

Upcoming Courses

Contact Us

Subject

Your Name (required)

Company/Organisation

Email (required)

Telephone

Training Course(s)

Your Message

Upload Example Document(s) (Zip multiple files)

Copyright, G Com Solutions Ltd, 2024.
Tower Bridge Business Centre, 46-48 East Smithfield, London E1W 1AW
0800 998 9248   |   9:00 a.m. till 5:30 p.m.

Connect With Me: