Forum Discussion
Dynamic Rank with different Tables and Sort
Anonymous
I believe FIRSTNONBLANK/LASTNONBLANK functions both work for you.
Rank measure = RANKX (ALL('Sales LY'),LASTNONBLANK('Sales LY'[Sales Actual],0),,DESC)
Paul Zheng
Don't forget to hit THUMBS UP and mark it as a solution if it helps you!
Hey Anonymous Thanks this helps me a lot but looks like if i have like weekly Sales for example the same data for each year repeated 5 times like if this were for 5 different weeks ( i didnt upload the file like this :/) the formula does not work 😞
any suggestions?
- Anonymous6 years agoNot applicable
Anonymous
I cannot picture how is your actual model look like exactly but if you need to rank sales in different weeks.
You could first create a weeknumber column using WEEKNUM function on the date column.
Then ALLEXCEPT the column as the context:
Measure = RANKX(ALLEXCEPT(Table,Table[Weeknum]),CALCULATE(SUM(Table[Sales])),,DESC,Dense)BTW you can also replace FIRSTNOBLANK with Calculate(SUM.
Paul Zheng
Don't forget to hit THUMBS UP and mark it as a solution if it helps you!