How to use Top N% Filter in Tableau Software – Skill Pill Video

top n% filter tableau software btprovider

We always discuss in our articles about new ways and techniques to represent our data in Tableau Software. We also like to believe that we always identify the best methods to easily explore data and highlight the valuable information we need. As we say most of the time, the data sets we have contain a lot of information. Not occasionally Tableau users run into the problem of crowding their views due to cluttered data sets. That is why it is good to remember that Tableau offers us unlimited possibilities to represent and to filter at any time the data we need to reach the desired results. Today we will discuss about Top N% filter that can be applied in our graphs to manage filters easier and finally to improve user experience.

In a previous article we discussed about Top N Set analysis in which we showed how we can build different tops in Tableau. For example, top 10 best employees or top 5 customers depending on the value of their orders. But today we will see how we can filter our data to view a certain percentage of it.

How do we use Top N% and when can it be useful?

Top N% filter is a feature available in Tableau that allows users to filter and display a certain percentage of their data. To better understand how it works, let’s take an example. Suppose we want to display product categories and their sales value but showing only the first 75% of the recorded values. Instead of crowding filter area in Tableau, we can add a Top N% filter to automatically display the first 25%, 50% or 75% of the values we have in our data set.

Top N% filter also helps end users to explore the data they are looking for more easily. Instead of adding multiple filters, making it difficult to manage, and increasing the complexity of the final view, we can create a single parameter to use based on our needs. Using Top N% filter we have the possibility to filter and display only a certain percentage of the data we are interested in. We can only display the first 5 customers with the highest sales in a certain region, without filtering by their name and without adding the region in the filters section.

Therefore, Top N% filter helps us to display the percentage of data that interests us. Whether we are talking about the first 8 product categories or the first half of the product categories depending on their sales, Top N% filter is a much quicker solution that helps us easily filter the information we want.

Next, we will show you how you can build the Top N% filter and how you can interpret it in your view.

Step 1: Connect to data

→ In Tableau Desktop, connect to Tableau: Sample-Superstore

Step 2: Create the visualization

Option 1:

→ Create a calculated field with the formula Index() <= Int(Size()/5) (feel free to modify the 5 value with any value, based on how small do you want your subset to be)

→ Add the calculated field to Filters and select True

→ Add any dimension to rows

→ The visualization will be filtered and will only show the first fifth of the dataset (the dimension sorted by default and then will filter the results

Option 2

→ Create a parameter with float data type, percentage format

→ Select Range in Allowable values section

→ Check Minimum = 0, Maximum = 1, Step = 0.25 (if you want the set to be split into 4)

→ Create a calculated field with the formula {Percentile([Sales], parameter created at #1)}

→ Create a calculated field with the formula [Sales] <= [#4 Field]

→ Add the #5 field into Filters and select True

→ Right click on the parameter and select Show Parameter

→ Add Category to columns and Sales to rows

→ You can now select the percentage of the data from the parameter slider

By Andrei Stan

Download Tableau Software