Forum Discussion
Filtering on two selected values
- 4 years ago
Hi Anonymous ,
Based on your description, I have created a simple sample:
Please try:
First, create a new table of all the teams for slicer:
Then creata a measure:
Flag = IF ( MAX ( 'Table'[Winning Team] ) IN SELECTCOLUMNS ( 'For Slicer', "Team", [Team] ) && MAX ( 'Table'[Losing Team] ) IN SELECTCOLUMNS ( 'For Slicer', "Team", [Team] ), 1, 0 )Add it to the filter:
Final output:
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Greg_Deckler Thanks for your answer.
I do kinda follow where you are going, however, I got no idea what to put into the return section of the measure, as I would like to display a table with all the gameid? - I do not see how I can filter the data tabel based on _SharedGames varaible?
Anonymous Yeah, I wasn't sure either! But, perhaps you could use this code in a Complex Selector. Essentially return 1 or 0 and use the Filter pane to filter to the 1's (the rows you want included in the visual). So like:
Measure =
VAR __Game = MAX('Table'[gameid])
VAR __TeamA = SELECTEDVALUE('Slicer1'[teamname])
VAR __TeamB = SELECTEDVALUE('Slicer2'[teamname])
VAR __TeamAGames = DISTINCT(SELECTCOLUMNS(FILTER('Table',[teamname] = __TeamA),"__gameid",[gameid]))
VAR __TeamBGames = DISTINCT(SELECTCOLUMNS(FILTER('Table',[teamname] = __TeamB),"__gameid",[gameid]))
VAR __SharedGames = INTERSECT(__TeamAGames, __TeamBGames)
RETURN
IF(__Game IN __SharedGames, 1, 0)
The Complex Selector - Microsoft Power BI Community