Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Filtering a parent based on the child

I have two tables - one named Issues and one named CorrectiveActions.  Each issue can contain 0 or more corrective actions.  I have the relationship established in Power BI and displaying the issues ...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi  Anonymous ,

    I created some data:

    Issuestable:

    CorrectiveActionstable:

    Here are the steps you can follow:

    1. Create calculated table.

    Slice_Table = DISTINCT('CorrectiveActionstable'[CorrectiveActions])

    2. Create measure.

    Flag =
    var _corrselect=SELECTEDVALUE('Slice_Table'[CorrectiveActions])
    var _own=CALCULATE(MAX('CorrectiveActionstable'[Own]),FILTER(ALL(CorrectiveActionstable),'CorrectiveActionstable'[CorrectiveActions]=_corrselect))
    return
    IF(
        MAX('CorrectiveActionstable'[Own])=_own,1,0)

    3. Use [CorrectiveActions] of Slice_Table as the slicer, Place [Flag] in Filters, set is=1, apply filter.

    4. Result:

    When selecting a slicer, all Issues corresponding to Own will be displayed

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly