Forum Discussion
TOP 3 achievers
Hello!
I have data that looks like this:
Product Sales Week
| A | 3 | 202212 |
| B | 3 | 202212 |
| C | 202212 | |
| D | 2 | 202212 |
| E | 202212 | |
| F | 1 | 202212 |
| A | 2 | 202216 |
| B | 202216 | |
| C | 3 | 202216 |
| D | 202216 | |
| E | 1 | 202216 |
| 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
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
2 Replies
- johnt75Super 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
- shamoFrequent Visitor
Works great! Thanks! 🙂