How to Show Top 5 and Bottom 5 in Tableau

Cody Schneider7 min read

Finding your star performers and identifying areas needing attention is a fundamental part of data analysis. Instead of scrolling through long lists, you can create a focused view in Tableau that shows just the top and bottom results - like your five best-selling products and your five worst-selling ones. This article guides you step-by-step through two reliable methods to build this exact type of report.

GraphedGraphed

Your AI Data Analyst to Create Live Dashboards

Connect your data sources and let AI build beautiful, real-time dashboards for you in seconds.

Watch Graphed demo video

Why Show Top and Bottom Performers?

Analyzing the extremes is a powerful way to generate actionable insights quickly. It cuts through the noise of average performers and directs your focus where it’s most needed. For example, a "Top 5 & Bottom 5" view can help you answer critical business questions like:

  • Sales & Marketing: Which marketing campaigns are generating the most leads, and which are falling flat? Which products are flying off the shelves, and which are collecting dust?
  • Operations: Which suppliers have the fastest delivery times, and which are causing delays? Which manufacturing lines have the highest output versus the lowest?
  • Customer Service: Which support agents are resolving the most tickets, and who might need additional training?

By isolating these groups, you can replicate what’s working for your top performers and develop targeted strategies to improve or discontinue your bottom performers. It's a foundational report for anyone looking to make more informed, data-driven decisions.

Free PDF Guide

AI for Data Analysis Crash Course

Learn how to get AI to do data analysis for you — the best tools, prompts, and workflows to go from raw data to insights without writing a single line of code.

Method 1: Using Combined Sets (The Easiest Way)

The most straightforward method in Tableau for this task involves creating two distinct "Sets" - one for your top performers and one for your bottom performers - and then combining them into a single group. A Set in Tableau is essentially a custom field that creates a subset of your data based on specific conditions you define.

Let's use the Sample - Superstore dataset that comes with Tableau and build a view showing the top 5 and bottom 5 sub-categories by total sales.

Step 1: Create a Set for the Top 5

First, we need to isolate the top 5 sub-categories based on their sales performance.

  1. In the Data pane on the left, find the dimension you want to analyze. In our case, right-click on Sub-Category.
  2. From the context menu, navigate to Create > Set.
  3. A dialog box will appear. Give your set a descriptive name, like Top 5 Sub-Categories by Sales.
  4. Click on the Top tab at the top of the dialog box.
  5. Select the option By field.
  6. Configure the criteria as follows:
  7. Click OK. You will now see your new set listed in the Data pane under the "Sets" section.

You have successfully created a dynamic group that will always contain your top 5 best-selling sub-categories.

Step 2: Create a Set for the Bottom 5

Next, we will repeat the process to create a set for the 5 worst-performing sub-categories.

  1. Right-click on Sub-Category again in the Data pane.
  2. Navigate to Create > Set.
  3. Name this new set something like Bottom 5 Sub-Categories by Sales.
  4. Go to the Top tab.
  5. Select By field again, but this time, change "Top" to "Bottom" in the first dropdown.
  6. The criteria should now be:
  7. Click OK. You now have your second set ready.

Step 3: Combine the Two Sets

The magic happens when you combine these two sets into one. This brings your top and bottom performers together into a single, filterable group.

  1. In the data pane, select both sets you just created. You can do this by clicking one, holding down the Ctrl key (or Command in macOS), and clicking the other.
  2. Right-click on either of the selected sets and choose Create Combined Set....
  3. Name your new combined set, for instance, Top & Bottom 5 Sub-Categories.
  4. Ensure the option All members in both sets is selected. This creates a union of the two sets, including every member from both your Top 5 and Bottom 5 lists.
  5. Click OK.

Step 4: Build Your Visualization

With the combined set created, building the final bar chart is simple.

  1. Drag your newly created combined set, Top & Bottom 5 Sub-Categories, onto the Filters shelf. By default, it will only include members "In" the set, which is exactly what we want. This filters your entire view to show only those 10 specific sub-categories.
  2. Drag the original Sub-Category dimension to the Rows shelf.
  3. Drag the Sales measure to the Columns shelf.
  4. To make it easier to read, click the sort button on the axis or in the toolbar to sort the bars in descending order. This will clearly group your top 5 at the top and your bottom 5 at the bottom.

You now have a clean bar chart showing just your best and worst performers side-by-side.

GraphedGraphed

Your AI Data Analyst to Create Live Dashboards

Connect your data sources and let AI build beautiful, real-time dashboards for you in seconds.

Watch Graphed demo video

Method 2: Using the RANK() Calculated Field

For those who want more control or need to embed this logic into more complex calculations, using the RANK() function is an excellent alternative. This method involves creating a single calculated field that identifies whether a dimension member is in the top 5 or bottom 5.

Step 1: Create a Calculated Field for the Filter

We'll write a single formula that returns TRUE for members in the top or bottom 5 and FALSE for everything else.

  1. Click the dropdown arrow at the top of the Data pane and select Create Calculated Field.
  2. Name the calculation Top & Bottom 5 Filter.
  3. Enter the following formula into the editor:
(RANK(SUM([Sales]), 'desc') <= 5)
OR
(RANK(SUM([Sales]), 'asc') <= 5)
  1. Click OK.

What this formula does:

  • RANK(SUM([Sales]), 'desc') <= 5 ranks all sub-categories from highest sales to lowest (descending) and checks if the rank is 1, 2, 3, 4, or 5. This identifies the top 5.
  • RANK(SUM([Sales]), 'asc') <= 5 ranks them in the opposite direction, from lowest sales to highest (ascending), identifying the bottom 5.
  • The OR statement combines these two conditions, so the calculation returns TRUE for any sub-category that meets either criteria.

Step 2: Build the Visualization with the Calculation

Using this calculated field as a filter is straightforward.

  1. Drag Sub-Category to the Rows shelf.
  2. Drag Sales to the Columns shelf.
  3. Drag your new Top & Bottom 5 Filter calculated field to the Filters shelf.
  4. In the filter dialog box that appears, check the box for True and click OK.

Your view will now be filtered just like in the Set method. Remember to sort your bars to neatly organize the chart.

Advanced Tips and Considerations

Making Your "N" Dynamic with Parameters

What if you want to see the Top & Bottom 3, 7, or 10? Instead of hardcoding "5" into your logic, you can use a Parameter.

  1. In the Data Pane, right-click and select Create Parameter.
  2. Name it Select N Value. Set the Data Type to Integer and Allowable values to Range, with a minimum of 1 and a maximum of 10. Click OK.
  3. Right-click the parameter and select Show Parameter.
  4. Now, edit your Set or Calculated field. Simply replace the number '5' with your new parameter, [Select N Value]. Now your end-users can change the 'N' value themselves!

Free PDF Guide

AI for Data Analysis Crash Course

Learn how to get AI to do data analysis for you — the best tools, prompts, and workflows to go from raw data to insights without writing a single line of code.

The Importance of Context Filters

If you have other filters on your view (e.g., Year, Region), you need to be careful about the order of operations. By default, a Top N set is calculated before standard dimension filters. This means if you filter for the "West" region, you might see fewer than 5 results because you are filtering the overall top 5 to see which ones happen to be in the West.

To fix this, right-click your dimension filter (e.g., the 'Region' pill on your Filters shelf) and select Add to Context. Context filters are applied first, ensuring your Top N calculation is performed after the view is filtered — giving you the Top 5 for the 'West' region, for example.

Final Thoughts

Visualizing your top and bottom performers is a high-impact analysis that cuts through the noise. Whether you prefer the intuitive approach of combining sets or the flexibility of a RANK calculation, Tableau gives you powerful tools to create these focused views without much hassle.

Having to go through these steps in traditional BI tools is often why these quick but valuable analyses don't happen. With Graphed, we designed a system where you can get the same result by just asking. Instead of clicking through menus to create sets and calculations, you can simply type, "Show me a bar chart of my top 5 and bottom 5 products by sales for last quarter," and instantly get the finished visualization. By connecting your data sources once, you enable your whole team to skip the setup and get straight to answering their questions.

Related Articles