Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Failing with RANK - how do you rank values in the scope of weeks?

Hi 

here's what's my data looks like - included image

 

As you can see, I'm able to use RANKX in the ALL scope, but I need to only rank the values in week scope.

in my image:

the value 87 should get the highest rank it its week, and not 791 that belongs to the week before.

 

Thank you

7 REPLIES 7
parry2k
Super User
Super User

@Anonymous i did the similar rank solution in another post, take a look.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

Thank you but it only did half the job (maybe i wasn't specific enough).

 

Now it looks like this - which is perfect, but i want to show that max value for every single day of the week.

So, if the max value is 87 for week 15:

i want that value to be displayed (in a card visual) for every single day, no matter which day is picked from the Date Picker, can't seem to find the right formula..

 

@Anonymous for max try following measures

 

Max in the week = 
MAXX( VALUES( Table[WeekNumber] ), [your measure] )


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

I tried that but it doesnt work, again it shows the value of the measure for each day.

@Anonymous i think i'm missing what you are looking for? Is there any way you can share your working pbix file, remove any sensitive information.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

Can't really, but here's a better view of my data.

 

The date 11/04/2019 is sliced but the "best in week" measure shows blank, even though there's the value 87 that is ranked 1 in that week.

 

Also, if I filter on the day before (10/04/2019) it shows the value 17 which ranked 3, and not the 1st rank of that week.

@Anonymous this will work, In expression, change table and column name as per your data model.

Best Sales in Week = 
VAR __year = MAX( DimDate[CalendarYear] )
VAR __week = MAX( DimDate[WeekNumberOfYear] )
RETURN 
MAXX( FILTER( ALL( DimDate ), DimDate[WeekNumberOfYear] = __week && DimDate[CalendarYear] = __year ), [Sales] )


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.