Forum Discussion
Count by MIN RANK per category
Hi all,
I am trying to count users per category for the lowest RANK in between the selected dates. The calculation has to be dynamic, working with the data slicer
Any help would be appreciated.
As you can see my User Count isn't correct. Thanks 🙂
Sample data that I used :
CategoryUserDateRANK
| a | 1 | 23/11/2022 | 3 |
| b | 1 | 16/08/2022 | 4 |
| b | 1 | 30/07/2022 | 5 |
| c | 1 | 11/02/2022 | 7 |
| c | 1 | 07/03/2023 | 1 |
| d | 1 | 27/01/2023 | 2 |
| d | 1 | 12/05/2022 | 6 |
| a | 2 | 09/01/2022 | 7 |
| a | 2 | 08/02/2022 | 6 |
| a | 2 | 25/02/2023 | 1 |
| c | 2 | 21/01/2023 | 2 |
| c | 2 | 17/11/2022 | 3 |
| b | 2 | 27/05/2022 | 4 |
| d | 2 | 20/03/2022 | 5 |
| c | 3 | 15/05/2022 | 5 |
| c | 3 | 14/03/2022 | 6 |
| d | 3 | 30/12/2022 | 4 |
| d | 3 | 01/01/2023 | 3 |
| a | 3 | 17/01/2023 | 2 |
| a | 3 | 03/03/2023 | 1 |
| a | 4 | 21/11/2022 | 2 |
| b | 4 | 14/02/2022 | 4 |
| b | 4 | 19/02/2023 | 1 |
| c | 4 | 06/04/2022 | 3 |
| c | 5 | 21/09/2022 | 3 |
| d | 5 | 25/11/2022 | 1 |
| d | 5 | 08/03/2022 | 5 |
| a | 5 | 25/09/2022 | 2 |
| a | 5 | 07/08/2022 | 4 |
| a | 6 | 26/02/2023 | 1 |
| c | 6 | 10/03/2022 | 4 |
| c | 6 | 23/06/2022 | 2 |
| b | 6 | 30/04/2022 | 3 |
| d | 7 | 17/04/2022 | 10 |
| c | 7 | 20/01/2023 | 3 |
| d | 7 | 21/04/2022 | 9 |
| d | 7 | 01/03/2023 | 1 |
| a | 7 | 18/10/2022 | 6 |
| a | 7 | 28/01/2023 | 2 |
| a | 7 | 08/10/2022 | 7 |
| c | 7 | 10/11/2022 | 4 |
| c | 7 | 21/08/2022 | 8 |
| b | 7 | 04/11/2022 | 5 |
| d | 8 | 22/11/2022 | 3 |
| c | 8 | 26/01/2023 | 1 |
| c | 8 | 19/01/2023 | 2 |
| d | 8 | 30/03/2022 | 4 |
| d | 8 | 13/03/2022 | 5 |
Hi , WOLFIE
According to your description, you want to get the " count users per category for the lowest RANK".
Here are the steps you can refer to :
(1)My test data is the same as yours.
(2)We can create a measure :
Measure = var _lowest_rank = MAX('Table'[Rank]) var _t =DISTINCT(SELECTCOLUMNS(FILTER('Table', 'Table'[Rank] = _lowest_rank) ,"User" , [User])) return COUNTROWS(_t)(3)Then we can meet your need , the result is as follows:
If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
2 Replies
- amitchandakSuper User
WOLFIE , TOP N should help
calculate(Count(Table[User]), TOPN(1, allselected(Table[Category]) ,calculate(Count(Table[User])) , desc) , Values(Table[Category]))
- v-yueyunzh-msftCommunity Support
Hi , WOLFIE
According to your description, you want to get the " count users per category for the lowest RANK".
Here are the steps you can refer to :
(1)My test data is the same as yours.
(2)We can create a measure :
Measure = var _lowest_rank = MAX('Table'[Rank]) var _t =DISTINCT(SELECTCOLUMNS(FILTER('Table', 'Table'[Rank] = _lowest_rank) ,"User" , [User])) return COUNTROWS(_t)(3)Then we can meet your need , the result is as follows:
If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly