Get Top 5 category values for each date from category

I have a column "category" which has more than 10 categories for each date. I would want to see only the Top 5 category for each date. Can I get a beast mode or a work around for the same.
I have attached an image for reference.
Best Answer
-
You can do this by using the rank window function in a beast mode and then adding it to the filter to filter where rank is less than or equal to 5.
RANK() OVER (PARTITION BY WEEKOFYEAR(`date`) ORDER BY SUM(`metricfield`) DESC)
If you don't have window functions for beast modes turned on in your instance, you will need to have your CSM enable it.
**Check out my Domo Tips & Tricks Videos
**Make sure toany users posts that helped you.
**Please mark as accepted the ones who solved your issue.1
Answers
-
You can do this by using the rank window function in a beast mode and then adding it to the filter to filter where rank is less than or equal to 5.
RANK() OVER (PARTITION BY WEEKOFYEAR(`date`) ORDER BY SUM(`metricfield`) DESC)
If you don't have window functions for beast modes turned on in your instance, you will need to have your CSM enable it.
**Check out my Domo Tips & Tricks Videos
**Make sure toany users posts that helped you.
**Please mark as accepted the ones who solved your issue.1
Categories
- All Categories
- 1.1K Product Ideas
- 1.1K Ideas Exchange
- 1.2K Connect
- 970 Connectors
- 259 Workbench
- Cloud Amplifier
- 1 Federated
- 2.4K Transform
- 76 SQL DataFlows
- 502 Datasets
- 1.8K Magic ETL
- 2.7K Visualize
- 2.2K Charting
- 379 Beast Mode
- 21 Variables
- 487 Automate
- 104 Apps
- 379 APIs & Domo Developer
- 6 Workflows
- 22 Predict
- 6 Jupyter Workspaces
- 16 R & Python Tiles
- 319 Distribute
- 67 Domo Everywhere
- 252 Scheduled Reports
- 59 Manage
- 59 Governance & Security
- 1 Product Release Questions
- 5K Community Forums
- 37 Getting Started
- 23 Community Member Introductions
- 64 Community Announcements
- 4.8K Archive