Forum Discussion

amitgajkal2007's avatar
amitgajkal2007
Frequent Visitor
2 years ago
Solved

Dax query

I have a table named (data) and two columns team1 and team2 want to undersand  1. count number of maches played by each team and  2. count of wins by each team   input data team1 team2 win...
  • Ritaf1983's avatar
    2 years ago

    Hi amitgajkal2007 
    The first step is to transform the table to vertical to make the analysis easier.

    You can do it with the "unpivot" option of PQ

    Then you will get the table as in the picture :

    From here you can create 2 simple dax measures :

    1. For matches :

    matches = COUNTROWS('Table')
    2. For wins:
    wins = CALCULATE([matches],SELECTEDVALUE('Table'[Team])='Table'[winner])
    Result :

    pbix is attached, you can follow my steps at pq and dax.

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