Forum Discussion
Measure returning value based on count ranking
Hello,
I have a table with the status of over 160K items. I want a measure to return the name of the status with the highest count. Then, I want another one for the status name of the second highest count so on and so forth until I have 5 measure for each of the 5 status I have.
Thanks for any help.
- Anonymous2 years ago
Hi Whoule
You can create several measures as follows.
count = CALCULATE(COUNT('Table'[ID]),ALLEXCEPT('Table', 'Table'[Status]))rank = RANKX(ALL('Table'), 'Table'[count],, DESC, Dense)first = CALCULATE(MAX('Table'[Status]), FILTER('Table', [rank] = 1))second = CALCULATE(MAX('Table'[Status]), FILTER('Table', [rank] = 2))third = CALCULATE(MAX('Table'[Status]),FILTER('Table',[rank] = 3))forth = CALCULATE(MAX('Table'[Status]),FILTER('Table',[rank] = 4))fifth = CALCULATE(MAX('Table'[Status]),FILTER('Table', [rank] = 5))Is this the result you expect?
Best Regards,
Community Support Team _Yuliax
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 Replies
- CoreyPSolution Sage
Can you provide a sample of your data please
- WhouleHelper I
Here is a test sample.
IDStatus
1 Closed 2 Free 3 Pending 4 Closed 5 Free 6 Free 7 Free 8 Free 9 Free 10 Free 11 Free 12 Free 13 Free 14 Closed 15 Closed 16 Closed 17 Closed 18 Free 19 Pending 20 Free 21 Pending 22 Free 23 Pending 24 Pending 25 Closed 26 Pending 27 Closed 28 Closed 29 Free 30 Free 31 Free 32 Free 33 Free 34 Free 35 Free 36 Free 37 Free 38 Free 39 Free 40 Free 41 Offline 42 Live 43 Free 44 Free 45 Pending 46 Pending 47 Closed 48 Live 49 Offline 50 Free 51 Free 52 Live 53 Free 54 Live 55 Free 56 Live 57 Free 58 Free 59 Pending 60 Free 61 Free 62 Live 63 Free 64 Free 65 Free 66 Free 67 Free 68 Free 69 Closed 70 Closed 71 Closed 72 Closed 73 Closed 74 Free 75 Free
- AnonymousNot applicable
Hi Whoule
You can create several measures as follows.
count = CALCULATE(COUNT('Table'[ID]),ALLEXCEPT('Table', 'Table'[Status]))rank = RANKX(ALL('Table'), 'Table'[count],, DESC, Dense)first = CALCULATE(MAX('Table'[Status]), FILTER('Table', [rank] = 1))second = CALCULATE(MAX('Table'[Status]), FILTER('Table', [rank] = 2))third = CALCULATE(MAX('Table'[Status]),FILTER('Table',[rank] = 3))forth = CALCULATE(MAX('Table'[Status]),FILTER('Table',[rank] = 4))fifth = CALCULATE(MAX('Table'[Status]),FILTER('Table', [rank] = 5))Is this the result you expect?
Best Regards,
Community Support Team _Yuliax
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.