cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

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
Highlighted
Super User IV
Super User IV

@daniellerp , 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])))

 



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Community Conference

Microsoft Power Platform Communities

Check out the Winners!

secondImage

Create an end-to-end data and analytics solution

Learn how Power BI works with the latest Azure data and analytics innovations at the digital event with Microsoft CEO Satya Nadella.

Top Solution Authors
Top Kudoed Authors