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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
xelune
New Member

Dynamic title for hierarchy slicer: How to always show lowest selected level

Hi there, 

 

I have a report that has KPIs structured into two columns, who are hierarchical - "Task" and "CoreTask". Each CoreTask has at least one, some multiple tasks. 

I solved the selection with a hierarchy slicer: CoreTask as Level 1 -> Task as Level 2

 

What I would like to do is have a dynamic header that always shows the lowest level selection - if a CoreTask and no Task is selected show CoreTask title; if a Task to a CoreTask is selected, only show Task title. The selection setting is single-selection. If a CoreTask is selected with no Task selected, it automatically selects all Tasks (could this be an issue?)

 

I have tried with the following DAX but I cannot get the title, except the prefix "active: " to show up. I would really appreciate if you could help me out here.

 

SlicerSelectionTitle =

IF(
    ISFILTERED('Finances'[Task]),
    "active: " & SELECTEDVALUE('Finances'[Task]),

        IF(
            ISFILTERED('Finances'[CoreTask]),
             "active: " & SELECTEDVALUE('Finances'[CoreTask])
    )
)

 

Dynamic Header based on Hierarchical Slicer Selection in Power BI | BI Consulting Pro | Power BI |4K... <- my resource for writing the DAX above

1 ACCEPTED SOLUTION
v-heq-msft
Community Support
Community Support

Hi @xelune ,
According to your description, first of all, when you select the parent category you select the child category by default, because the parent category has a higher priority than the child category, which is the logic of how the hierarchical slicer works. If you don't want to select the parent category and just want to focus on the subcategories, you can try to use the custom visual object Hierarchy Slicer and select one of them to act only on the leaf level

vheqmsft_0-1713506201169.png

vheqmsft_1-1713506223216.png

Next is the solution to the header
Depending on your needs, you can use a card instead of a slicer header and use your created measure to put in and close the slicer header and the Card Category lable so that you can dynamically change the slicer header

vheqmsft_2-1713506883764.png

Of course you can also use the Show Summary feature of the Slicer header, which will show you the level and details you have selected.

vheqmsft_3-1713507009538.png

 

Best regards,

Albert He

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 



View solution in original post

2 REPLIES 2
v-heq-msft
Community Support
Community Support

Hi @xelune ,
According to your description, first of all, when you select the parent category you select the child category by default, because the parent category has a higher priority than the child category, which is the logic of how the hierarchical slicer works. If you don't want to select the parent category and just want to focus on the subcategories, you can try to use the custom visual object Hierarchy Slicer and select one of them to act only on the leaf level

vheqmsft_0-1713506201169.png

vheqmsft_1-1713506223216.png

Next is the solution to the header
Depending on your needs, you can use a card instead of a slicer header and use your created measure to put in and close the slicer header and the Card Category lable so that you can dynamically change the slicer header

vheqmsft_2-1713506883764.png

Of course you can also use the Show Summary feature of the Slicer header, which will show you the level and details you have selected.

vheqmsft_3-1713507009538.png

 

Best regards,

Albert He

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 



Thank you, the card solution is a good workaround. You do not by any chance happen to know how I can then have one background around the card visual and slicer? 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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