cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mehul26
Frequent Visitor

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!!!
Check out my External Tool for Power BI Desktop!
Microsoft Hates Greg's Quick Measures
Check out my latest book!

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!!!
Check out my External Tool for Power BI Desktop!
Microsoft Hates Greg's Quick Measures
Check out my latest book!

Helpful resources

Announcements
Power BI October Update 2021.jpg

Power BI Release

Click here to read more about the October 2021 Release!

Microsoft Ignite 768x460.png

Find your focus

Explore the latest tools,training sessions,technical expertise, networking and more.

Power BI Womens Summit 2021 768 x460.jpg

Interviews, learning sessions, allies, and more!

#PowerBIWomenSummit

Teds Dev Camp Oct. 2021 768x460.jpg

Power BI Dev Camp - October 28th, 2021

Mark your calendars and join us for our next Power BI Dev Camp!