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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
FetchCB
Regular Visitor

Hirearchy Slicer - Getting Value Selected

I Have  Sales Hireachy Consisting of Depot,Region,Division and Company all siting in a Hirearchal Slicer.

 

What Id like to do is to have a card that shows the value that was selected whether it was a depot or a region ie If a region was selected then show the region.

 

Ive tried to create a measure and then use that measure for the card but none of the functions appear to work eg SelectedValue

 

Any ideas how i might achieve this?

1 ACCEPTED SOLUTION

Hi  Think I have got this sorted now 

 

My example data:

 

Depot Hirearchy

depotHirearchy.JPG

Transactions

 

Transactions.JPG

 

The issue I was having that I couldnt get a card to dynamically show the value id selected in the hirearchy ie if I picked the South Division I wanted the Card to show South.

 

This was my solution:

 

Create a measure ( I called it Depot Selection) in the Depot Hirearchy and use the following formula

 

DepotSelected = " Transactions For " & IF(ISFILTERED('Depot Hirearchy'[Depot]),SELECTEDVALUE('Depot Hirearchy'[Depot]),IF(ISFILTERED('Depot Hirearchy'[Region]),SELECTEDVALUE('Depot Hirearchy'[Region]),IF(ISFILTERED('Depot Hirearchy'[Division]),SELECTEDVALUE('Depot Hirearchy'[Division]),IF(ISFILTERED('Depot Hirearchy'[Comapny]),SELECTEDVALUE('Depot Hirearchy'[Company]))))) 

 

This is in reverse order to the Hirearchy as what I discovered was that all the levels above the level you choose are also "Filtered" so by using the IF statement in reverse order I can find out which level is the first Filtered level which logically must be the level chosen.

 

This is what the sample report looks like

 

Report.JPG

 

Many thanks for replying and offering to help 

View solution in original post

2 REPLIES 2
Greg_Deckler
Super User
Super User

Can you post some sample data so that I can try this out? I am thinking that if you do something like a SUMMARIZE of your table or perhaps a CALCULATETABLE or just the current table that you could grab the MAXX of whatever column value you are looking for since your current table should only have the values currently selected in the hierarchy slicer.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hi  Think I have got this sorted now 

 

My example data:

 

Depot Hirearchy

depotHirearchy.JPG

Transactions

 

Transactions.JPG

 

The issue I was having that I couldnt get a card to dynamically show the value id selected in the hirearchy ie if I picked the South Division I wanted the Card to show South.

 

This was my solution:

 

Create a measure ( I called it Depot Selection) in the Depot Hirearchy and use the following formula

 

DepotSelected = " Transactions For " & IF(ISFILTERED('Depot Hirearchy'[Depot]),SELECTEDVALUE('Depot Hirearchy'[Depot]),IF(ISFILTERED('Depot Hirearchy'[Region]),SELECTEDVALUE('Depot Hirearchy'[Region]),IF(ISFILTERED('Depot Hirearchy'[Division]),SELECTEDVALUE('Depot Hirearchy'[Division]),IF(ISFILTERED('Depot Hirearchy'[Comapny]),SELECTEDVALUE('Depot Hirearchy'[Company]))))) 

 

This is in reverse order to the Hirearchy as what I discovered was that all the levels above the level you choose are also "Filtered" so by using the IF statement in reverse order I can find out which level is the first Filtered level which logically must be the level chosen.

 

This is what the sample report looks like

 

Report.JPG

 

Many thanks for replying and offering to help 

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.