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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
andrearuggeri
Helper I
Helper I

Best and worst shop per week

Hi all,

I'm quite new to the whole Power BI thing and I'm trying to achieve all my reporting needs 🙂

I have a table with the daily sales coming from several shops (sorry for the long table)

What I would like to achieve is to have the best and worst selling shop in the last week (data gets updated every monday morning) and the amount of sales for that shop(s)

In the example the best shop in the last week would be ROMA (PORTA DI ROMA) with a total of 36 sales and the worst shop would be ARESE (MI) with 5 sales.

Thanks a lot!

 

DateShopSalesWeek
05/10/2020ROMA (PORTA DI ROMA)341
09/10/2020ROMA (PORTA DI ROMA)341
09/10/2020ORIO AL SERIO (BG)441
10/10/2020ROMA (PORTA DI ROMA)1341
10/10/2020ORIO AL SERIO (BG)1541
11/10/2020ORIO AL SERIO (BG)1141
11/10/2020ROMA (PORTA DI ROMA)1641
16/10/2020ORIO AL SERIO (BG)342
17/10/2020ORIO AL SERIO (BG)842
18/10/2020ORIO AL SERIO (BG)1242
16/10/2020ARESE (MI)2042
17/10/2020ARESE (MI)3142
23/10/2020ROMA (PORTA DI ROMA)1243
23/10/2020ORIO AL SERIO (BG)1443
23/10/2020ARESE (MI)543
24/10/2020ROMA (PORTA DI ROMA)1243
25/10/2020ROMA (PORTA DI ROMA)1243

 

2 REPLIES 2
amitchandak
Super User
Super User

@andrearuggeri , Try measures like

//assumes sales measure

Shop Rank desc  = RANKX(all(Table[Shop]),[Sales])

 

Shop Rank asc= RANKX(all(Table[Shop]),[Sales],,asc)

 

Rank top 1 bottom 1 = sumx(filter(VALUES(Table[Shop]),[Shop Rank desc ]=1 || [Shop Rank asc] =1 ),[Sales] )

 

For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale
https://community.powerbi.com/t5/Community-Blog/Dynamic-TopN-made-easy-with-What-If-Parameter/ba-p/3...

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Not sure I completely got it.

 

I did take a look to the RANKX thing but if I'm not wrong the solution you provided is not aggregating the sales per week, so the rank is per date...

 

I need to determine for each week which is the shop with the max total sales, then I need it to know for the latest week.

 

EDIT: I will edit the original post since I realize there's a missing part, sorry (

 

Thanks a lot

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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