Forum Discussion
Create a rank column based on summary
- 5 years ago
Hi ar-data ,
You can refer to the following calculated column:
>>1. Now I want to create a rank column and raking should be based on total amount value for a customer for a year
RankbyYear = var a = SUMMARIZE('Table','Table'[Year],'Table'[Customer],"_amount",SUM('Table'[Amount])) var b = ADDCOLUMNS(a,"_rank",RANKX(FILTER(a,'Table'[Year] =EARLIER('Table'[Year])),[_amount])) return SUMX(FILTER(b,'Table'[Year] = EARLIER('Table'[Year])&&'Table'[Customer] = EARLIER('Table'[Customer])),[_rank])>>2. And another rank column and ranking should be based on total amount value for a customer ignoring year or any other column
Rank = var a = SUMMARIZE('Table','Table'[Customer],"_amount",SUM('Table'[Amount])) var b = ADDCOLUMNS(a,"_rank",RANKX(a,[_amount])) return SUMX(FILTER(b,'Table'[Customer] = EARLIER('Table'[Customer])),[_rank])If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
sayaliredij amitchandak Thank you for the response.
The ranking has to be assigned after aggregating the Amount values for a particular Customer as there are more than one line item for each customer in each year. So I need something that iterates and then assigns rank. I tried 'Earlier' but somehow that's not working.
ar-data , In case In missed something on earlier , refer sub category rank Under this topics
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns
Also check measure Rank
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures