Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Include Exclude option in Power BI matrix visual

Hi Is ther any way to hide the option for Include/exclude option on matrix visual whe we do a right click on row?

 

  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi Anonymous,

    You can create a measure with unrelated table fields filters and extract selected values to compare with current row contents to return tag.  After these steps, you can use this measure on 'visual level filter' as a filter to achieve include or exclude effect filter effect.

    Applying a measure filter in Power BI 

    Calculate Table:

     

    Selector=Values(Table[Column])

     

    Measures:

     

    measure filter (Include) =
    VAR selected =
        ALLSELECTED ( Selector[Column] )
    RETURN
        IF ( SELECTEDVALUE ( Table[Column] ) IN selected, "Y", "N" )
    
    measure filter (Exclude) =
    VAR selected =
        ALLSELECTED ( Selector[Column] )
    RETURN
        IF ( SELECTEDVALUE ( Table[Column] ) IN selected, "N", "Y" )
    

     

    Notice: if you do not want to add an additional table as the source of measure filter, you can consider defining variables into the measure and compare that variable with current row contents.

    Static measure filter (Include) =
    VAR selected = {"A","B","C","D"}
    RETURN
        IF ( SELECTEDVALUE ( Table[Column] ) IN selected, "Y", "N" )
    
    Static measure filter (Exclude) =
    VAR selected = {"A","B","C","D"}
    RETURN
        IF ( SELECTEDVALUE ( Table[Column] ) IN selected, "N", "Y" )

    Regards,

    Xiaoxin Sheng

     

4 Replies

    • WendyDUFE's avatar
      WendyDUFE
      Helper III

      amitchandak  HI Amitchandak, 

       

      I have the same needs as well. For my case, when publishing the pbix file, I set the filter pane as hide. So when user browse the report from web side, after they select include or exclude, they can not cancel it, which brought a lot of confusion. 

       

      This is a cool feature, but it is prefered to be optional, not default.  

       

      Any idea ? 

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous,

    You can create a measure with unrelated table fields filters and extract selected values to compare with current row contents to return tag.  After these steps, you can use this measure on 'visual level filter' as a filter to achieve include or exclude effect filter effect.

    Applying a measure filter in Power BI 

    Calculate Table:

     

    Selector=Values(Table[Column])

     

    Measures:

     

    measure filter (Include) =
    VAR selected =
        ALLSELECTED ( Selector[Column] )
    RETURN
        IF ( SELECTEDVALUE ( Table[Column] ) IN selected, "Y", "N" )
    
    measure filter (Exclude) =
    VAR selected =
        ALLSELECTED ( Selector[Column] )
    RETURN
        IF ( SELECTEDVALUE ( Table[Column] ) IN selected, "N", "Y" )
    

     

    Notice: if you do not want to add an additional table as the source of measure filter, you can consider defining variables into the measure and compare that variable with current row contents.

    Static measure filter (Include) =
    VAR selected = {"A","B","C","D"}
    RETURN
        IF ( SELECTEDVALUE ( Table[Column] ) IN selected, "Y", "N" )
    
    Static measure filter (Exclude) =
    VAR selected = {"A","B","C","D"}
    RETURN
        IF ( SELECTEDVALUE ( Table[Column] ) IN selected, "N", "Y" )

    Regards,

    Xiaoxin Sheng

     

  • Anonymous  Hi Shilpi, 

     

    Have you tried the solution? does it work ? 

     

    Thank you