The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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?
Solved! Go to 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.
Thank you @amitchandak for your input!!
@amitchandak below is a screenshot of my sample data:
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:
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.
Thank you @amitchandak for your input!!
@jsuttmann , what is the column name here
it should be
'<Tablename>'[column name]. [Hierarchy element]