We have Seller, product, GMV. How to find list of ...
# gooddata-cloud
k
We have Seller, product, GMV. How to find list of Top 20 product under each seller based on GMV
k
Thinking completed To find the top 20 products under each seller based on GMV, you can use a MAQL metric with the
TOP(...) IN (...) WITHIN (...)
ranking filter [TOP or BOTTOM(n) IN]. The
WITHIN
clause partitions the ranking so that it evaluates per seller rather than globally across all sellers [TOP or BOTTOM(n) IN]. 1. Create a Ranked GMV Metric Define a metric in MAQL that calculates GMV only for the top 20 products within each seller:
Copy code
SELECT {metric/gmv}   WHERE TOP(20) IN (     SELECT {metric/gmv} BY {label/seller}, {label/product}, ALL OTHER   )   WITHIN ({label/seller}, ALL OTHER)
In this metric: â€ĸ
BY {label/seller}, {label/product}
specifies the dimensionality to evaluate the ranking against [TOP or BOTTOM(n) IN]. â€ĸ
WITHIN ({label/seller}, ALL OTHER)
ensures the ranking resets for each seller, returning the top 20 products per individual seller [TOP or BOTTOM(n) IN]. 2. Configure the Visualization 1. Create a table visualization. 2. Add Seller and Product to the rows/attributes. 3. Add your newly created ranked metric to the metrics section. The table will display only the top 20 products for each seller based on their GMV [TOP or BOTTOM(n) IN]. 👍 0 button 👎 0 button â„šī¸ Tip: Mention @kapa.ai in the thread for follow-ups. 👀 Our Support team monitors all messages and will jump in if needed.
m
Hi Krishti, I have reviewed the AI Assistants response and I can see it provided a good response on how to achieve the list of Top 20 products under each seller based. But just let us know if you need any assistance from our team