Forum Discussion
Implementing a TopN filter per category
Could someone point me in the right direction to achieve this? - sure, with sample data and expected output clearly provided
- BachDinh3 years ago
Helper I
Hi smpa,
The expected output (for ease this is just top 3) would be something like this: Total Sales by Country for top 3 products in each country:
Product Germany UK Israel A 1256 240 B 700 600 C 800 800 D 643 543 450 So as you see, each country might have a different set of top 3 products but I would like to include all the top 3 products of all countries while excluding the total sales values where it doesn't belong to a top 3 for a specific column/country.
The most important sample data is as follows (store ID is linked to a stores table which contains the Country information, and date is linked to a calendar table):
Sales Date Kiosk ID Product ID Sales Amount 12/02/23 1 A 23.4 5/02/23 2 A 54.0 12/02/23 3 B 12.0 I already have measures in place for totaling the sales, I am just struggling with inclusion of top N products per category