Solution of the Week: Top N within categories

Solution of the Week: Top N within categories

Consider the sales data spread across days, regions, product categories, products, customers. And you want to know the Top 10 products in each year. If you try to do a simple Top 'N' filter, it will club everything up and show the 10 rows with the most sales.



But what we need is something different. It is Top 10 products by sales in each year, i.e., for each year, we need the top 10 selling products. Here's how it can be achieved, using the rank() function.

1. Create an Aggregate Formula called Rank Sales.


2. Create a new Pivot View. Drop Date (Year) and Product columns in the Rows shelf. Drop Rank Sales and Sales in the Data shelf.



3. In Rank Sales, click Actual, and choose By Base Fields -> Product.



4. Go to Filters tab. Create a new Filter to get the top 10 ranks alone. Drop Rank Sales, click Add New Range -> Below 11.

 

When you generate the pivot, it will be like the below.



Hope you found this solution useful. You can find the Workspace with the above example here - https://analytics.zoho.com/workspace/19601000019999012

Try this out in your own usecases. Like for example, Top 5 Customers By Sales Person, Top 10 Tickets Overdue By SupportRep (or By Customer) etc.

    Access your files securely from anywhere

        Zoho Developer Community




                                  Zoho Desk Resources

                                  • Desk Community Learning Series


                                  • Digest


                                  • Functions


                                  • Meetups


                                  • Kbase


                                  • Resources


                                  • Glossary


                                  • Desk Marketplace


                                  • MVP Corner


                                  • Word of the Day



                                      Zoho Marketing Automation


                                              Manage your brands on social media



                                                    Zoho TeamInbox Resources

                                                      Zoho DataPrep Resources



                                                        Zoho CRM Plus Resources

                                                          Zoho Books Resources


                                                            Zoho Subscriptions Resources

                                                              Zoho Projects Resources


                                                                Zoho Sprints Resources


                                                                  Qntrl Resources


                                                                    Zoho Creator Resources



                                                                        Zoho Campaigns Resources


                                                                          Zoho CRM Resources

                                                                          • CRM Community Learning Series

                                                                            CRM Community Learning Series


                                                                          • Kaizen

                                                                            Kaizen

                                                                          • Functions

                                                                            Functions

                                                                          • Meetups

                                                                            Meetups

                                                                          • Kbase

                                                                            Kbase

                                                                          • Resources

                                                                            Resources

                                                                          • Digest

                                                                            Digest

                                                                          • CRM Marketplace

                                                                            CRM Marketplace

                                                                          • MVP Corner

                                                                            MVP Corner





                                                                              Design. Discuss. Deliver.

                                                                              Create visually engaging stories with Zoho Show.

                                                                              Get Started Now