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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Anonymous
Not applicable

Rank based on latest date

Hello, 

 

I have a data set with 3 weeks of sales data for products. I need to rank the products by the latest week's sales only and I still need to be able to display the sales totals for the other weeks as well. 

 

Below is a simplified version of the data set. I want to rank the products based on the highlighted info. 

 

daniellerp_0-1601301537323.png

 

Here's the output I'm trying to get to: 

daniellerp_1-1601301726362.png

 

Any suggestions would be greatly appreciated!

 

 

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , Create a measure like this and create Rank on that. Better to separate date table

 

 

Last Week =
var _max = maxX(allselcted('Date'), 'Date'[Week Rank])
return
CALCULATE(sum('order'[Qty]), FILTER(('Date'),'Date'[Week Rank]=_max))

 

or

Last Week =
var _max = maxX(allselcted('Date'), 'Date'[Week Rank])
return
CALCULATE(sum('order'[Qty]), FILTER(ALLselected('Date'),'Date'[Week Rank]=_max))

 

or

Last Week = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])))

 

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

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