Forum Discussion
Parent-Child Hierarchy Filtering Conditions
Anonymous That means you have a syntax error, you need to close the FILTER function with )
Try adding the red ) as below and delete the final 😞
TEST = IF(ISBLANK(MAXX(FILTER('Project Tracker';'Project Tracker'[Title]="Apple" && 'Project Tracker'[State]="Done");'Project Tracker'[Parent Work Item Id]));"A";IF(MAXX(FILTER('Project Tracker';'Project Tracker'[Title]= "Apple" && [State]="Done");[Parent Work Item Id])=MAXX(FILTER('Project Tracker';[Title]= "Pear"&& [State]="To Do");[Parent Work Item Id]); "YES"; "NO"))
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.
AllisonKennedy The formula works now, thanks!
But as result it shows in the new "TEST" column in all cells the red "A" from the formula below - do you think we missed here something else?
TEST = IF(ISBLANK(MAXX(FILTER('Project Tracker';'Project Tracker'[Title]="Apple" && 'Project Tracker'[State]="Done");'Project Tracker'[Parent Work Item Id]));"A";IF(MAXX(FILTER('Project Tracker';'Project Tracker'[Title]= "Apple" && [State]="Done");[Parent Work Item Id])=MAXX(FILTER('Project Tracker';[Title]= "Pear"&& [State]="To Do");[Parent Work Item Id]); "YES"; "NO"))
- AllisonKennedy6 years ago
Community Champion
Sorry, you can change the red A to "No" and are you doing this as a MEASURE or Column? It will not work as a Column, so needs to be done as a MEASURE.
Do as a MEASURE, but you will need to use it in the right configuration, so only works/makes sense when used in a Matrix or Table with Parent Name or ID in the rows.
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.
- Anonymous6 years agoNot applicable
Hi AllisonKennedy ,
I changed "A" to "NO", put the formula in a measure and involved in a matrix report - but there is no change. All the values are shown with "NO" now.
Would it be possible for you to explain the 3 areas of the formula - maybe I can check the steps from myside when I am able to understand the formula?
TEST =IF (ISBLANK (MAXX(FILTER('Project Tracker';'Project Tracker'[Title]="Apple" && 'Project Tracker'[State]="Done");'Project Tracker'[Parent Work Item Id]));"NO";IF (MAXX(FILTER('Project Tracker';'Project Tracker'[Title]="Apple" && 'Project Tracker'[State]="Done");'Project Tracker'[Parent Work Item Id])=MAXX(FILTER('Project Tracker';'Project Tracker'[Title]="Pear" && 'Project Tracker'[State]="To Do");'Project Tracker'[Parent Work Item Id]);"YES";"NO"))- AllisonKennedy6 years ago
Community Champion
Anonymous Here's my best attempt at explaining my reasoning behind the formula, along with some inline commments below:
My thinking is that you want to get the Parent based on a condition looking at two different children, so I have created a MEASURE that finds all parents that meet child 1 condition, and checks if that is the same parent for child 2 condition. This only works when created in the context of a Matrix using the Parent name in rows and the MEASURE in values, because that list of 'all parents' will only look for/accept the current selected value of parent as per the filter context of the rows in the matrix, and if both children return that parent, then they are equal to each other and therefore it returns "yes" show the Parent. Because there are times when a given parent will not meet either condition, I have added the check for ISBLANK to make sure that blank = blank doesn't give you a false positive.
Anonymous wrote:Hi AllisonKennedy ,
I changed "A" to "NO", put the formula in a measure and involved in a matrix report - but there is no change. All the values are shown with "NO" now.
Would it be possible for you to explain the 3 areas of the formula - maybe I can check the steps from myside when I am able to understand the formula?
TEST =IF (ISBLANK (MAXX(FILTER('Project Tracker';'Project Tracker'[Title]="Apple" && 'Project Tracker'[State]="Done");-- Look for Title = Apple and State = Done in the Project Tracker table, note this will use the filter context of the matrix so will only check for the projects with the parent ID in the row in the matrix'Project Tracker'[Parent Work Item Id]));-- If Title = Apple and State = Done, return the max Parent Work Item Id"NO";-- If Parent Work Item Id is not found, it will be blank, so "NO" will be returned-- This next part will only happen if Parent Id is not blank and the parent Id for the parent in the matrix row has at least one child with Title = Apple and State = DoneIF (MAXX(FILTER('Project Tracker';'Project Tracker'[Title]="Apple" && 'Project Tracker'[State]="Done");'Project Tracker'[Parent Work Item Id])--check again for the same parent Id for Title = Apple and State = Done (we already know it's not blank)=-- check if that Apple Done project parent ID is equal to Pear To DoMAXX(FILTER('Project Tracker';'Project Tracker'[Title]="Pear" && 'Project Tracker'[State]="To Do");'Project Tracker'[Parent Work Item Id]);-- check for the Parent Id for child 2 (Pear To Do)"YES";-- If both children are found in the Parent Id, return "Yes" (show that parent in the filter)"NO")-- If not both children are found, return "No")