We hope you love the products we recommend! Just so you know, when you buy through links on our site, we may earn an affiliate commission. This adds no cost to our readers, for more information read our earnings disclosure.
Find out how to display top N lists in Tableau using the filter option.
In this tutorial, we will teach you how to show top 10 values in Tableau using the filter method.
Whether you want to make a chart or display only the top/bottom N values within a category, this method should work for you.
For this example, we’ll use the supersample store dataset, and try to display dynamically the top 10 products that sold the most.
How to show top 10 records in Tableau
1. Prepare your data and chart
We want to analyze sales by products. In this example, I’ve plotted the required data in a horizontal bar chart view.
By default, the chart below shows all the products and total sales in an alphabetical order.
2. Sort the view in a descending order by sales
We want to see the top performing products first, from the best performing ones to the worst ones. That’s why we need to sort the view descending by total sales within product categories.
To achieve that, click on the “Sort” icon (arrow down) found in the toolbar.
3. Optional: create an index to see the # of rows
This step is optional, but helpful when creating lists or table views. If you want to get a better perspective on how many rows are displayed.
Create a calculated field with the following formula: INDEX()
Then we need to convert it to discrete.
Right click on the calculated field you created, Index, click on “Convert to Discrete”
Finally, drag the Index to the “Rows”
Now we have the rank numbers (index rows) displayed in our charts. We can easily see that we have 17 dimensions, but we only want the top 10. Let’s see how we can achieve this.
4. Show only the Top 10 results
First, create a filter by dragging the main dimension you want to use as a filter to the “Filter” area.
Right click on the newly created filter and click “Edit Filter…”
Go to the Top section, select “By field”, choose “Top” and write the number of items you want to be displayed in the chart, which can be any number you want.
Select the Top section and edit “By Field” requirements
For this tutorial, I’ve selected to be shown the top 10 sub-categories by sum of sales.
5. Final Result
Here we have the final chart displaying the top 10 best-sold products. What’s great about it, is that the list is dynamic, meaning that if the data changes, our top list will be updated accordingly.
There are many ways to show top N lists in Tableau, some use parameters or custom calculated fields using RANK, etc.
But this filter method is the simplest and uses filters options.