Forum Discussion
Count or distinct count
Hi UK_User123456 ,
I am now confused and not very much clear with your requirements.
Your first post says you want the count of codes, but now it says it is based on different data.
Could you be more specific or provide some sample data?
With your sample data and specific requirements it would be easy for us to resolve your issues ASAP.
Thanks,
Tejaswi
As with my previous post, I have created a column within my data table set that gives me the ranking of the code by the date as follows:
| ID | Date | Code | Power Bi Measure Ranking | |
| 1 | 03/01/2017 | 4110 - Uni | 1 | |
| 1 | 02/01/2017 | 4110 - Uni | 1 | |
| 2 | 01/05/2019 | 4112 - Coll | 1 | |
| 3 | 02/02/2018 | 4131 - Store | 1 | |
| 4 | 01/06/2018 | 4121 - STA | 1 | |
| 1 | 12/01/2017 | 4110 - Uni | 2 | |
| 1 | 15/07/2018 | 4110 - Uni | 3 | |
| 1 | 21/02/2019 | 4110 - Uni | 4 | |
| 4 | 12/08/2018 | 4121 - STA | 2 | |
| 3 | 12/02/2019 | 4131 - Store | 2 | |
| 3 | 15/05/2019 | 4131 - Store | 3 | |
| 4 | 13/02/2019 | 4121 - STA | 3 | |
| 4 | 02/06/2018 | 4121 - STA | 1 | |
| 3 | 17/06/2019 | 4131 - Store | 4 | |
| 3 | 30/06/2019 | 4131 - Store | 5 | |
| 4 | 16/07/2019 | 4121 - STA | 4 | |
| 2 | 01/07/2019 | 4112 - Coll | 2 |
Potential final output based on ranking 1:
| Code | Count of Code |
| 4110 - Uni | 2 |
| 4112 - Coll | 1 |
| 4131 - Store | 1 |
| 4121 - STA | 3 |
I am now thinking that this cannot be done based on creating a ranking column in my dataset.
TIA
- v-xuding-msft7 years agoCommunity Support
Hi UK_User123456 ,
Have you got the column of Power Bi Measure Ranking using the formula of ID Rank (ASC)? If so, you can create a measure to count code.
Measure = CALCULATE(COUNT('table 1'[Code]),FILTER('table 1','table 1'[ID Rank (ASC)] = 1))Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.