Forum Discussion
Count/CountA counting wrong category
- 5 years ago
Hi, Anonymous
Based on your description, I assume that you want to filter by player and get win% for each player. I created data to reproduce your scenario. The pbix file is attached in the end.
Table:
Names(a calculated table):
Names = DISTINCT( UNION( DISTINCT('Table'[Winner's Name]), DISTINCT('Table'[Loser's Name]) ) )You may create a measure as below.
Win % = var result = DIVIDE( COUNTROWS( FILTER( ALL('Table'), [Winner's Name]=SELECTEDVALUE(Names[Name]) ) ), COUNTROWS( FILTER( ALL('Table'), OR( [Winner's Name]=SELECTEDVALUE(Names[Name]), [Loser's Name]=SELECTEDVALUE(Names[Name]) ) ) ) ) return IF( ISBLANK(result), 0, result )Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, Anonymous
Based on your description, I assume that you want to filter by player and get win% for each player. I created data to reproduce your scenario. The pbix file is attached in the end.
Table:
Names(a calculated table):
Names =
DISTINCT(
UNION(
DISTINCT('Table'[Winner's Name]),
DISTINCT('Table'[Loser's Name])
)
)
You may create a measure as below.
Win % =
var result =
DIVIDE(
COUNTROWS(
FILTER(
ALL('Table'),
[Winner's Name]=SELECTEDVALUE(Names[Name])
)
),
COUNTROWS(
FILTER(
ALL('Table'),
OR(
[Winner's Name]=SELECTEDVALUE(Names[Name]),
[Loser's Name]=SELECTEDVALUE(Names[Name])
)
)
)
)
return
IF(
ISBLANK(result),
0,
result
)
Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.