Forum Discussion
Count or distinct count
The calculation in my data set is
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
- UK_User1234567 years agoResolver I
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 Rank (ASC) =RANKX(FILTER('table 1','table 1'[ID] = EARLIER('table 1'[ID] ) &&'table 1'[Date] = EARLIER('table 1'[Date] )),'table 1'[Date],,ASC,DENSE)And then I have a measure which gives me the output of the "code" based on which rank I want to output which is:Code Rank =CALCULATE(MIN('Table 1'[Code] ),'Table 1'[Code Rank (ASC)] = 1)I just need to be able to do a count of the output based on the ranking I choose, so say I opt to only show ranking 1, it will display all the codes that have a rank of "1" against it.example dataset below: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.