Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Filtering across two columns.

I have a dataset from a series of squash games, providing the information around each point from these matches. What I would like in my report is to be able to filter for 1 name to return the statistics around every match/point that player played, however from match-to-match in the database, players will sometime appear in the player A column and other times in player B depending on the draw of the tournament.

 

 

 

Although I could filter for the same name twice (once for each column) to return all of their match stats, is there a way in which one filter could look for the player across both player A and B columns in one go?

  • Hi Anonymous ,

     

    Check this file as example: Download PBIX 

     

    I've create a disconected table with players and a measure to filter the visual.

     

    _MatchID =
    VAR _player = SELECTEDVALUE(tb_Player[Player])
    VAR _matchID = CALCULATETABLE(tb_Match; FILTER(tb_Match; tb_Match[PlayerA] = _player || tb_Match[PlayerB] = _player))
    RETURN IF(ISFILTERED(tb_Player[Player]); IF(COUNTROWS(_matchID) > 0; 1; 0); 1)
     

2 Replies

  • camargos88's avatar
    camargos88
    Community Champion

    Hi Anonymous ,

     

    Check this file as example: Download PBIX 

     

    I've create a disconected table with players and a measure to filter the visual.

     

    _MatchID =
    VAR _player = SELECTEDVALUE(tb_Player[Player])
    VAR _matchID = CALCULATETABLE(tb_Match; FILTER(tb_Match; tb_Match[PlayerA] = _player || tb_Match[PlayerB] = _player))
    RETURN IF(ISFILTERED(tb_Player[Player]); IF(COUNTROWS(_matchID) > 0; 1; 0); 1)
     
  • v-xicai's avatar
    v-xicai
    Community Support

    Hi Anonymous ,

     

    You may enter into query editor, select the [Player A Name] and [Player B Name] at the same time, then right click to choose "Unpivot Columns" option, you can rename this result column "Attribute" with "Player Name" . Don't forget to click the "Close & Apply" button.

     

    Best Regards,

    Amy 

     

    Community Support Team _ Amy

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.