Forum Discussion
Rank AVG for the data subset
- 4 years ago
Hi kubaalbrecht ,
You just need to change the code in step 2 to
= Table.AddIndexColumn(Table.Sort([allrows], {"Sets diff", Order.Descending}), "DiffRank",1)The other steps remain the same and get the same result.
If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi kubaalbrecht ,
You just need to change the code in step 2 to
= Table.AddIndexColumn(Table.Sort([allrows], {"Sets diff", Order.Descending}), "DiffRank",1)
The other steps remain the same and get the same result.
If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello, once more.
Sorry for continue asking. I though I will be able to continue on my own, but fortunatelly I am not.
Now I would like to add one more column defining the result of every single player in a every single tournament:
- value "winner" if the ranking of the player is the lowest ranking in the single tournament
- value "loser" if the ranking of the playes is the highest ranking in the single tournament
- value "middle" in other cases
Can you please help me in this excercise as well?
Thank you.
- v-kkf-msft4 years agoCommunity Support
Hi kubaalbrecht ,
If you have the same number of people for each tournament, then you can create the following custom column.
= if [DiffRank] = 1 then "winner" else if [DiffRank] = 4 then "loser" else "middle"If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz- kubaalbrecht4 years agoRegular Visitor
Hello, thank you for you answer.
Unfortunally the task is not as easy because of the shared rankings and average rankings.
For example:
- winner:
- if a single person has the lowest ranking (= the highest difference between sets won and sets lost), then winner's ranking = 1
- if two persons have the lowest ranking, then both winners' ranking = 1.5
- if three persons have the lowest ranking, then all the winners' ranking = 2
- the same way for losers:
- a single loser: ranking 4
- two shared losers: ranking 3.5
- three shared losers: ranking 3
When you check rankings above, it is obvious that:
- ranking 2 may be winner or middle based on the ranking of other players in the same tournament
- ranking 3 may be loser or middle based on the ranking of other players in the same tournament
That is why a simple static condition considering only single player's ranking is not enough. Context of the ranking of other players within the same tournament must be considered.
So what I am asking for:
- "winner" is the player whose ranking equals the lowest ranking of the certain tournament
- "loser" is the player whose ranking equals the highest ranking of the certain tournament
- "middle" is the player who is not winner nor loser (= whose ranking does not equal lowest nor highest ranking of the certain tournament)
Thank you for your help.
- v-kkf-msft4 years agoCommunity Support
Hi kubaalbrecht ,
Please try the custom column.
= let CurID = [Tournament ID], tab = Table.SelectRows(#"Added Custom1", each [Tournament ID] = CurID), minrank = List.Min(tab[Rank_avg]), maxrank = List.Max(tab[Rank_avg]) in if [Rank_avg] = minrank then "winner" else if [Rank_avg] = maxrank then "loser" else "middle"Best Regards,
Winniz
- winner: