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
mehul26
Helper I
Helper I

How to de-select the only child node for Parent in Hierarchy slicer and leave parent node selected?

We have Group/Sector and Division in our hierarchy.  By default when a parent node is selected, the child nodes are automatically selected.  I have measures that determine when user has clicked on Parent level or child level by comparing the count of children with # of selected children for a given parent.  The issue we run into is when a parent only has one child.  There’s no way for me to determine if Parent box is selected or child box since both gets selected, and there’s no way to de-select the only child by using the ctrl-click.  I’ve also looked at 3rd party slicers but can’t find the correct solution.  The ideal solution would be to de-select the only child and just have the parent node selected.  The easiest workaround we could think is to add a dummy child with a dot ( . ) under parent nodes with only single child. 

 

Is there any other workaround or solution?

3 REPLIES 3
v-yalanwu-msft
Community Support
Community Support

Hi @mehul26 , 

 

According to you description, if you want to determine when user has clicked on Parent level or child level ,you could use DISTINCTCOUNT(‘parent’) and DISTINCTCOUNT(‘child’) to distinguish difference.

However, when  a parent only has one child. If you click one ,another must be clicked. because Only leaves (lowest items) can be selected .So they were all chosen. In addition , The content you selected the parent node and the content you selected its all child nodes are the same.

 

If you only want a parent node's name, you can use SELECTEDVALUE() function.

For example, if you want to whether the parent is selected, you could create a measure:

selectparent = SELECTEDVALUE(Table1[Country])

v-yalanwu-msft_0-1622102456679.png

 

Reference:

https://azurebi-docs.jppp.org/powerbi-visuals/hierarchy-slicer.html?tabs=docs%2Cdocs-open

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.  

Greg_Deckler
Super User
Super User

@mehul26 Another thought here is if ISINSCOPE might be of use. ISINSCOPE function (DAX) - DAX | Microsoft Docs


@ 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...
Greg_Deckler
Super User
Super User

@mehul26 Sharing formulas may help. Question, why does it matter which is selected, parent/child, for parents with only 1 child?


@ 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...

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.