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