Forum Discussion
DAX query for Games Winning %
Hi rohitbinnani,
Since column [Team A] belongs from a different table and [Winner] comes from another table, you should first combine them into a single table based on specific relationship.
As I don't know what relationship is between the original two tables, suppose the combination table looks like above you posted. And there are two slicers in your report, one is for [Team A], another is for [Year]. In that case, please create measures like:
CountSelectedWinner =
CALCULATE (
COUNTA ( 'Game Winning'[Winner] ),
FILTER (
'Game Winning',
'Game Winning'[Winner] = LASTNONBLANK ( 'Game Winning'[Team A], 1 )
)
)
CountTeamA =
CALCULATE (
COUNTA ( 'Game Winning'[Team A] ),
FILTER (
'Game Winning',
'Game Winning'[Team A] = LASTNONBLANK ( 'Game Winning'[Team A], 1 )
)
)
Winning% = [CountSelectedWinner]/[CountTeamA]
If I have something misunderstood, please provide more description about your requirement.
Thanks,
Yuliana Gu
- rohitbinnani9 years ago
Advocate III
Hi v-yulgu-msft,
i tried it with different table. what if my filter of Team A is in and connected in this table as per a primary key. we have team A in this table itself but i have another dimension from which i am bringing my Team A as filter just because that is also connected to some more tables to filter them too. can you help me in this ?
the script you provided works perfect if they belong from same table. !!!
Regards,
Rohit Binnani.