Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Parent-Child Hierarchy Filtering Conditions

Hi, I am very new in Power BI and have following issue to find the right formula combination in Power BI.

Is this possible in Power BI and if yes how can I realize thi?

Thanks in Advance 🙂

 

18 Replies

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

    I would maybe start by creating a separate Parent table and linking that to the Child table using ID to ParentID. 

     

    The first part of your filter condition is easy enough > Filter for Apple and Done, it's the AND with the second child that is making me think a bit, as you would typically need to do this as an OR.

     

    Will you only ever have 2 conditions required? Or does the solution need to allow for more?

     

    Has this post solved your problem? Please mark it as a solution so that others can find it quickly and to let the community know your problem has been solved. 

     

    If you found this post helpful, please give Kudos.

    I work as a trainer and consultant for Microsoft 365, specialising in Power BI and Power Query. 

    https://sites.google.com/site/allisonkennedycv

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Allison, thanks for your quick reply!

      Point 1 (linking that to the Child table using ID to ParentID) is done.

      Point 2 (would typically need to do this as an OR) I need here here also an AND condition to filter exatly for the right items - otherwise it would show me also the wrong parent items.

       

      Can you show me an example of the formula for point 2 please?

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

        Try something like this, as a MEASURE:

         

        DoneApples = IF(ISBLANK(MAXX(FILTER(Child,Child[Item]= "Apple" && Child[Status] = "Done"),Child[Parent ID])),"A",IF(MAXX(FILTER(Child,Child[Item]= "Apple" && Child[Status] = "Done"),Child[Parent ID])=MAXX(FILTER(Child,Child[Item]= "Pear"&& Child[Status] = "Done"),Child[Parent ID]), "Yes", "No"))
         
        Then put it in a table or matrix with the Parent[Name]. 
         
        It can probably be made a bit more elegant if you have the time, but let me know if that doesn't make sense or if it works. 
         

        Has this post solved your problem? Please mark it as a solution so that others can find it quickly and to let the community know your problem has been solved. 


        If you found this post helpful, please give Kudos.

        I work as a trainer and consultant for Microsoft 365, specialising in Power BI and Power Query. 

        https://sites.google.com/site/allisonkennedycv