While analyzing sales performance across the country, our management team wanted to identify the Top 10 states contributing the highest sales. Instead of reviewing data for all 50 states in the USA, they only needed to focus on the states that generated the most revenue in sales.
By creating a chart in Tableau that shows the top States by Sales, we could highlight the states with the highest sales and compare their sales contribution.
In this tutorial, I will explain how to show the top N results in a Tableau chart using the various methods.
Show Top N Results in Tableau Chart
In Tableau, there are three ways to display the top n results in the Tableau charts.
- Show top N results in Tableau using filters
- Show top N results in Tableau using parameters
- Show top N results in Tableau using rank calculation
Show Top N Results in Tableau Using Filters
In this example, we will create a bar chart that displays sales for the top states. To do this, connect the Tableau Superstore dataset and follow the steps below.
- Select the dimension in which you want to filter the top records and drag it to the filters. In this example, I will use ‘State/Province‘.
- In the filter window, click on the Top tab. After this, select By field -> Sales. After this, select ‘Top 10’ and click ‘OK’.

- Press the “Ctrl” key and drag the states from the Filter to the Rows. With this, we will get the filtered states on the chart.

- To show the sales for each state, drag the Sales to the Columns.

- To sort the sales in ascending or descending order, click on the sort button in the navigation bar.

- To show the sales values for the top 10 states, drag the sales to the Label card in the Marks section.

Now, we can see the sales of the top 10 states in the Tableau chart, arranged in descending order.
This way, we can filter the top ‘n’ records in Tableau by using the filters.
Show Top N results in Tableau Using Parameters
Another way to show the top “N” results in Tablesu is by using the parameters. In this method, we can dynamically change the number of filtered records and display them on a chart.
In this example, using the Tableau Superstore dataset to show the profit for the top 5 product subcategories.
Connect the Tableau with the Superstore dataset and follow the steps below.
- To create a parameter, click on the dropdown near the search bar and select Create Parameter.

- Enter the parameter name, such as “Top Dimension,” and select the Data Type as “Float.” Then, in the Current Value, select the records you want to filter and click the OK button.

- After this, drag the dimension (sub-category) to the Filters. In the filters, select the Top tab, then select “By field” and choose “Profit“. Then, in the “Top” section, select the “Top dimension” parameter and click OK.

- Now, hold the “Ctrl” key and drag the dimension “Sub-Category” from the filter to the Rows. After this, add the ‘Profit‘ measure to the Columns. With this, we will get the top records for the Current value (10) we have entered in the parameter.

- Sort the order from the sort button in the navigation bar and add the Profit to the Label card in the Marks section.

- To change the top “n” numbers dynamically, click on the parameter “Top Dimension” in the side bar and select Show Parameter.

- Now, on the right side of the chart, we will see the parameter Top Dimension. From here, we can change the number of top “N” records, and as we refresh the chart, the same number of top records will be displayed on the chart.

This way, we can dynamically filter the top “n” records in a Tableau chart using the parameters.
Show Top N results in Tableau Using Rank Calculation
In this method, we will create a calculated field for rank calculation to display the top N records in the Tableau chart. In this chart, we will display the sales for the top states using the Superstore dataset.
- Right-click in the Data Pane → Create Parameter and add the following details.
- Name: Top N.
- Data Type: Integer.
- Current Value: 10.
- Select Range, and add the minimum and maximum values of the range.
- Click OK.

- Create a calculated field with the label Index Filter and enter the formula below. This formula will filter the top n results using RANK.
IF RANK(SUM([Sales])) <= [Top N] THEN
"Show"
ELSE
"Hide"
END- Now, drag State to Rows and Sales to Columns.

- Drag the calculated field to the Filters. Then, in the Filter, select the Show checkbox and click OK.

- To dynamically change the top “N” numbers, click on the parameter Top N and select Show Parameter.

- Now, we can see the “Top N” parameter on the right side of the chart, from which we can dynamically change the “N” value to display the top “N” results.

As we change the parameter digit, the same number of top results will be displayed in the Tableau chart.
This way, we can show the top N results in Tableau using rank calculation.
Conclusion
In this Tableau tutorial, we learned how to show the Top N results in Tableau in three simple ways. In the first method, we used filters to display the top 10 records. Then, in the second method, we used parameters to make the chart dynamic, allowing users to change the number of top records.
Then, in the last method, we used a rank calculation to get more control in displaying the top n results. Using these methods, we can highlight key information, such as the top states by sales or any other measure comparison for top dimensions.
You may also like to read:
- 100% Stacked Bar Chart in Tableau
- Slope Chart in Tableau
- Circle Timeline Chart in Tableau
- Pie Chart With Multiple Measures in Tableau
I am Bijay Kumar, the founder of SalesforceFAQs.com. Having over 10 years of experience working in salesforce technologies for clients across the world (Canada, Australia, United States, United Kingdom, New Zealand, etc.). I am a certified salesforce administrator and expert with experience in developing salesforce applications and projects. My goal is to make it easy for people to learn and use salesforce technologies by providing simple and easy-to-understand solutions. Check out the complete profile on About us.