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.