Forum Discussion

Guli's avatar
Guli
Icon for Helper I rankHelper I
6 years ago
Solved

How to filter a table based on selected slicer result.

I have two tables like below: Table A: Table B: I want to relate these two tables, but since their relationship is many to many, using Related function is not useful. My objective r...
  • v-yingjl's avatar
    6 years ago

    Hi Guli ,

    You can set the many-to-many relationships status as inactive and create this measure to achieve it:

    matchkey_with_TableB = 
    IF (
        ISFILTERED ( 'Table B'[ID] ),
        CALCULATE (
            MAX ( 'Table B'[Filmtype] ),
            USERELATIONSHIP ( 'Table A'[Film], 'Table B'[Filmtype] )
        )
    )

     

    Attached sample file that hopes to help you: How to filter a table based on selected slicer result.pbix

     

    Best Regards,
    Yingjie Li

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

  • v-yingjl's avatar
    v-yingjl
    6 years ago

    Hi Guli ,

    You can create this measure:

    indicator = 
    IF(
        SELECTEDVALUE('Table A'[Film]) = 'Table A'[matchkey_with_TableB],
        1,BLANK()
    )

     

    Best Regards,
    Yingjie Li

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