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.
v-jianboli-msft
Community Support
3 years agoHi 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.
Moehimby
Helper III
2 years agoFor me, it created a circular dependance on [YEAR] and failed.