How to Show Top 3 in Tableau
Showing just your top-performing items is one of the most common requests in data visualization. Whether it’s your top 3 products, top 5 sales reps, or top 10 marketing campaigns, highlighting what’s working best is critical. This guide will walk you through several ways to show the top 3 in Tableau, moving from a quick and simple filter to more powerful dynamic methods.
The Easiest Method: Using a Top N Filter
Tableau has a built-in feature designed specifically for this task. Using a standard dimension filter is the most direct way to show your top items based on a measure. This method is fast, efficient, and perfect for static reports or one-off analyses.
When to Use a Top N Filter
This is your go-to method when you need a quick, no-fuss filter and you don't require the user to change the number of items shown (e.g., from Top 3 to Top 5). It's built directly into the filter interface and requires no custom calculations.
Step-by-Step Instructions
Let's find the top 3 best-selling product Sub-Categories from Tableau's Sample Superstore dataset.
- Create your basic view. Drag Sub-Category to the Rows shelf and SUM(Sales) to the Columns shelf. You'll get a simple bar chart. It’s also a good idea to sort it descending to immediately see who the leaders are.
- Drag the dimension you want to filter (Sub-Category) from the side pane to the Filters shelf.
- A dialog box will pop up. Go to the Top tab at the top of this box.
- Select the option By field.
- The default options will be Top 10 by SUM(Sales). Simply change the number 10 to 3.
- Confirm that the measure is set to Sales and the aggregation is Sum. Click OK.
That’s it! Your view now shows only the top 3 Sub-Categories by their total sales. This is a wonderfully simple approach, but it lacks the flexibility for more advanced dashboarding.
Free PDF · the crash course
AI Agents for Marketing Crash Course
Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.
Using Table Calculations for More Control: INDEX() and RANK()
For more control and flexibility, you can use table calculations. These are special functions in Tableau that compute based on the visible data in your view, or "the table." The two most common functions for this task are INDEX() and RANK().
Method 1: Using the INDEX() Function
The INDEX() function simply returns the index, or row number, of the current row in the partition. Think of it as a counter. If you sort your Sub-Categories by sales, the one with the highest sales will be row number 1, the second highest will be number 2, and so on. We can leverage this to create our filter.
Step-by-Step Instructions
- Set up your sheet with Sub-Category on Rows and SUM(Sales) on Columns. Sort the chart descending by SUM(Sales). This is a critical step, as INDEX() depends on the sort order.
- Create a new calculated field. You can do this by right-clicking in the empty space of the side pane and selecting Create Calculated Field.
- Name your calculated field something like "Row Index". In the formula box, simply type:
INDEX() - Click OK. You now have a new field in your side pane. Because it's a table calculation, it has a small delta (triangle) symbol next to it.
- Drag your new Row Index field to the Filters shelf.
- A "Filter Field" dialog will appear. Since
INDEX()returns a number, you can set a range of values. For the Top 3, set the range from 1 to 3. Click OK.
Your chart is now filtered to the Top 3. The INDEX() method is handy, but the RANK() function is often more intuitive and robust, especially when dealing with ties.
Method 2: Using the RANK() Function
The RANK() function is semantically clearer than INDEX() because it’s designed specifically for ranking. It assigns a rank to each item based on a measure. It’s also better at handling situations where you have ties in your data (e.g., two products with the exact same sales figure).
Tableau offers a few variations like RANK_DENSE() or RANK_UNIQUE() to manage ties differently, but for most use cases, the standard RANK() is perfect.
Step-by-Step Instructions
- Start with your basic bar chart of Sub-Category and SUM(Sales).
- Create a new calculated field named "Sales Rank".
- The formula for this field will be:
RANK(SUM([Sales]))This tells Tableau to rank each mark in the view based on the sum of its sales. - Drag the new Sales Rank field to the Filters shelf.
- In the "Filter Field" dialog, set the range to 1 to 3 and click OK.
You’ve once again created a Top 3 view. The RANK() method is generally preferred over INDEX() for ranking scenarios as it is more explicit about your intention.
A Pro Move: Grouping the Rest into an "Other" Category
Sometimes you don't just want to hide the items outside your top 3 - you want to combine them into a single "Other" group. This gives you valuable context, allowing you to compare your top performers to the rest of the pack combined. The best way to achieve this is by using a Tableau Set.
Step-by-Step Instructions
- First, create a Set based on your top 3 items. Find Sub-Category in your side pane, right-click it, and go to Create > Set.
- Name the set something clear, like "Top 3 Sub-Categories Set".
- In the create set dialog, navigate to the Top tab.
- Just like with a Top N filter, select By field and configure it to be the Top 3 by Sales (Sum).
- Click OK. You now have a Set that dynamically includes only your current top three sub-categories.
- Now, create a calculated field to use this set for grouping. Right-click in the side pane and create a new calculated field named "Top Performers vs Other".
- Use this simple IF statement:
- To use your new grouping, remove the original Sub-Category pill from the Rows shelf.
- Drag your new Top Performers vs Other field to the Rows shelf.
Your chart now shows the individual bars for your top 3 performers and a single bar representing the summed sales of all other sub-categories. This is a very professional and insightful way to present a "Top N" analysis.
Going Interactive: Letting Users Choose with a Parameter
The most flexible solution is to empower your users to decide whether they want to see the Top 3, Top 5, or Top 10. You can do this by pairing a table calculation with a Parameter. A parameter is a user-input field that can be integrated into your calculations.
Free PDF · the crash course
AI Agents for Marketing Crash Course
Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.
Step-by-Step Instructions
- First, create the parameter. Right-click an empty area in the side pane and choose Create > Parameter.
- Set it up as follows:
- Click OK. Your parameter will now appear at the bottom-left of your screen. To make it interactive, right-click on it and select Show Parameter. A small controller will now appear in your view.
- Now, we need to link this parameter to our filter. This requires a calculated field that acts as a simple TRUE/FALSE test.
- If you haven't already, create the "Sales Rank" calculated field mentioned in the RANK() method section above, with the formula
RANK(SUM([Sales])). - Create a new calculated field called "Top N Filter".
- Use the following formula:
[Sales Rank] <= [Top N To Show]This formula compares the rank of each item to the number selected in your parameter. It returns "True" for items that fall within the top N and "False" for everything else. - Drag this Top N Filter field to the Filters shelf.
- A filter dialog box will appear. Check the box for True and click OK.
Now, your dashboard is interactive! Any user can use the "Top N To Show" slider or entry box to change the number of items displayed in real-time. This transforms a static chart into a flexible analysis tool.
Final Thoughts
Filtering your view to show top performers is a fundamental skill in Tableau. From the basic Top N filter to interactive parameters, Tableau gives you several paths to accomplish this goal. Choosing the right method depends on whether you need a quick static chart or a flexible, user-driven dashboard experience.
While mastering these functions is a great way to advance your Tableau skills, it's not always the fastest way to an answer. Often, creating calculations, sets, and parameters can feel like a roundabout process just to ask a simple business question. That’s why we built Graphed. Instead of following multiple steps, you can just ask in plain English: "show me a bar chart of the top 3 sub-categories by sales this year." Our AI analyst builds the live dashboard for you in seconds, saving you from navigating menus and writing formulas, so you can spend less time building and more time analyzing.
Related Articles
How to Create Facebook Ads API for Claude Code
Create a Meta Marketing API access token that never expires, using a system user, so Claude Code can pull Facebook ad reports and manage campaigns.
ClickHouse vs Postgres: When to Switch to Columnar
Comparing ClickHouse vs PostgreSQL means matching storage architecture to workload. Row storage wins for transactions. Columnar wins for scan-heavy analytics.
Google Ads for Orthodontists: Get More Booked Consults
Most orthodontic Google Ads campaigns waste money on low-intent searches. The problem is structure, not the platform.