Forum Discussion
Using Visualization Slicer to Exclude/Filter Selection from Table
- 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
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
Thank you for your help, Tom. That worked!
As a follow up, I am trying to do the same thing specifically for players (so when I select a player, it includes only their stats in a new, players only table but the averages of the rest in the existing second table). The problem I'm facing is that as I create a new unrelated table for players, it is also unrelated to the team table. As a result, if I have two slicers: Team and Player, when I select a team in the slicer filter, it does not filter my subsequent players slicer (to show only those players associated with the team). Is it possible to relate the players with the teams, while still continuing to maintain the selection?
Regards