Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Using Visualization Slicer to Exclude/Filter Selection from Table

Power BI Community,   I am trying to figure out a way to accomplish the following:   Say I have a table that looks like this in Power BI:              Along with a dropdown visualiza...
  • TomMartens's avatar
    TomMartens
    7 years ago

    Hey,

     

    thanks for uploading sample data.

     

    I created a simple "Team" table, by using this simple DAX statement:

     

    Team = 
    VALUES(Sheet1[Team]) 

    The idea behind this table is just this - use a column from an unrelated table for the Team slicer.

     

     

    I created the following measure that returns TRUE if something from the team table is selected:

    chkFilteredTeam = 
    ISFILTERED('Team'[Team]) 

    I assigned this measure to the table Team, basically this measure helps if nothing is selected in the slicer to show all teams and all player.

     

    I also created the following two measures

    SelectedTeam = 
    IF([chkFilteredTeam] 
        ,SUMX(
            'Sheet1' 
            ,IF('Sheet1'[Team] IN VALUES(Team[Team]),1,0)
        )
        ,0
    )
    SelectedTeamPlayer = 
    IF([chkFilteredTeam] 
        ,SUMX(
            'Sheet1' 
            ,IF('Sheet1'[Team] IN VALUES(Team[Team]),1,0)
        )
        ,1
    )

     

    I then used the measure "SelectedTeam" in the visual level filter of the matrix visual that "just" shows the team:

     

    and the 2nd measure in the visual level filter band of the 2nd matrix visual like so:

     

    I guess the following screenshot shows what you are looking for, please be aware that the upper slicer is not used the lower slicer is based on the new table:

     

    Regards,

    Tom