Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
jsuttmann
Helper I
Helper I

Reference Hierarchy in Measure?

I'm trying to get the value of the item selected in a hierarchy, but I can't reference the heirarchy in a measure.  In this example, I created a hierarchy (123Hierarchy) with three levels.  I'm not sure of the best method to return the value selected, but found an older post (link) that uses the ISFILTERED function in a series of embedded IF statements.  However, I can't seem to reference that hierarchy.  Is there a method to get the currently selected value in a hierarchy?  

Hierarchy1.png  Hierarchy2.png

1 ACCEPTED SOLUTION

I was able to resolve this issue by referring to the columns of the hierarchy without referencing the hierarchy name.  Since I only allow a single selection from the hierarchy, I created the measure using a SWITCH statement, starting at the lowest level of the hierarchy.  The same approach works with embedded IF statements as long as the first IF statement is the lowest level of the hierarchy.

Hierarchy6.png
Thank you @amitchandak for your input!!

View solution in original post

5 REPLIES 5
jsuttmann
Helper I
Helper I

@amitchandak below is a screenshot of my sample data:

Hierarchy4.png
When I created the hierarchy, I right-clicked on column 'ONE' and selected "Create hierarchy", named it '123Hierarchy', and added columns 'TWO' and 'THREE' to the hierarchy.  Since the hierarchy isn't a column in the 'TEST2' table, it doesn't show up as an option when I start typing the DAX expression:

Hierarchy5.png

I was able to resolve this issue by referring to the columns of the hierarchy without referencing the hierarchy name.  Since I only allow a single selection from the hierarchy, I created the measure using a SWITCH statement, starting at the lowest level of the hierarchy.  The same approach works with embedded IF statements as long as the first IF statement is the lowest level of the hierarchy.

Hierarchy6.png
Thank you @amitchandak for your input!!

jsuttmann
Helper I
Helper I

@amitchandak with both of your suggestions, I get the same error on referencing the hierarchy:

Hierarchy3.png



@jsuttmann , what is the column name here 

 

it should be 

'<Tablename>'[column name]. [Hierarchy element]

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
amitchandak
Super User
Super User

@jsuttmann , Try like

isfiltered(Test2[123Hierarchy].ONE)

 

or

 

isfiltered(Test2[123Hierarchy].[ONE])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors