Forum Discussion
Krystyna
3 years agoRegular Visitor
Rankx for every year
Hello Krystyna here I am new in PowerBi world and I need some help with a RANKX function. My data has only three columns: ProductId, Year, Value I need to rank products for every year. I created ...
- 3 years ago
Hi Krystyna ,
Based on your description, I have created a simple sample:
Please try:
Measure = RANKX(ALLEXCEPT('Table','Table'[Year]),CALCULATE(SUM('Table'[Value]),FILTER(ALLEXCEPT('Table','Table'[Year]),[ID]=EARLIER('Table'[ID]))),SUM('Table'[Value]),,Dense)Output:
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
3 years agoSuper User
Krystyna , Try like
ProductRank = RANKX(filter(ALL('Table'[Year], Table[Product]), Table[Year] = Max(Table[Year])), CALCULATE(SUM('Table'[Value])),,desc,dense)
Measure Rank: https://www.youtube.com/watch?v=DZb_6j6WuZ0&list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb&index=40
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
Krystyna
3 years agoRegular Visitor
Still all are 1