Forum Discussion

rehtdats's avatar
rehtdats
Regular Visitor
3 years ago

Filter Parent based on child selection

Hello,

 

I have an interesting problem I'm trying to set up a visual for and I can't quite get the filter set up correctly. We have a data structure that looks like this:

 

I want to be able to select any of the child values via a filter but filter the parents that contain that child. So, for example, if I select Child "A" it would apply a filter like this:

 

From that I want to create a visual that would look something like this:

 

Any help would be greatly appreciated, thanks!

2 Replies

  • ValtteriN's avatar
    ValtteriN
    Icon for Community Champion rankCommunity Champion

    Hi,

    Here is one way to do this:

    Data:

     



    Dax:

    Parent Filter Measure =
    var _child = MAX('Table'[Child]) return
    IF(COUNTROWS(FILTER('Table','Table'[Child]=_child))>0,1,0)

    Apply the filter measure like this:

    For the result table you can utilize similar logic for example:

    Count child =
    var _child = MAX('Table'[Child]) return

    COUNTROWS(FILTER(ALL('Table'),'Table'[Child]=_child))

     

    I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

    My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/

    • rehtdats's avatar
      rehtdats
      Regular Visitor

      Thanks ValtteriN,

       

      I have sucessfully been able to get the child counts a number of different ways, but I'm still struggling to get that overall parent count along with the "rate" is ultimately what I'm trying to get. No matter how I slice it the parent counts keep aligning with the child counts and all the rates are 100%.