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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
shamo
Frequent Visitor

TOP 3 achievers

Hello!

 

I have data that looks like this:

 

Product  Sales    Week

A3202212
B3202212
C 202212
D2202212
E 202212
F1202212
A2202216
B 202216
C3202216
D 202216
E1202216
F 202216

 

I want to have three different measures ("First", "Second", "Third") which will respectively show top 3 selling product based on Total Sales. With current data I should get following results from these 3 measures:

 

Since product A sells the most Measure "First" should return: A

Since product B & C sells second most Measure "Second" should return: B; C

And then measure "Third" should return: D

 

Any help is appriciated. Thanks! 

 

/shamo

 

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

You can do this with a few measures. Firstly you need a ranking measure,

Sales Ranking = RANKX( ALL('Table'[Product]), [Total Sales],,,Dense)

and then to return the top product

First = CONCATENATEX( FILTER( VALUES('Table'[Product]), [Sales Ranking] =1 ), 'Table'[Product], ", ")

then the same for second and third

View solution in original post

2 REPLIES 2
shamo
Frequent Visitor

Works great! Thanks! 🙂

johnt75
Super User
Super User

You can do this with a few measures. Firstly you need a ranking measure,

Sales Ranking = RANKX( ALL('Table'[Product]), [Total Sales],,,Dense)

and then to return the top product

First = CONCATENATEX( FILTER( VALUES('Table'[Product]), [Sales Ranking] =1 ), 'Table'[Product], ", ")

then the same for second and third

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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