Forum Discussion
Need help on Ranking within table.
- 10 months ago
It really depends on what you're expecting as an output.
Assumptions for the below:
- I used your sample data and created a table called 'sample'
- I created a measure called _delay = SUM('sample'[Delay])
Create this measure, put it in the visual filters where it is 1.
__rank = VAR __locations = ALLSELECTED('sample') VAR __ranked = ADDCOLUMNS( __locations , "__delay", [_delay] , "__rank", RANKX( __locations , [_delay] , BLANK() , DESC , Skip ) ) VAR __top = TOPN( 5 , __ranked , [__rank], ASC , [__delay], DESC , 'sample'[Location], ASC ) VAR __isTop = CONTAINS( __top , 'sample'[Location], SELECTEDVALUE('sample'[Location]) ) VAR __result = IF( __isTop , 1 , 0 ) RETURN __resultMy code is GitHub Copilot assisted, but always tested.
Hi,
Clearly show the result that you are expecting.
Hi BhavaniK ,
Thanks for reaching out to the Microsoft fabric community forum.
I would also take a moment to thank KNP , for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference.
I hope the below details help you fix the issue. If you still have any questions or need more help, feel free to reach out. We’re always here to support you
Best Regards,
Community Support Team
- v-menakakota9 months agoCommunity Support
Hi BhavaniK ,
I hope the above details help you fix the issue. If you still have any questions or need more help, feel free to reach out. We’re always here to support you.
Regards,
Microsoft Fabric Community Support Team.