How to create a Set to show Top 3 even when we filter?

woman in black and white striped long sleeve shirt using macbook pro


In some business scenarios we can come across a requirement where we have to create a set, which will keep showing “Top 3” items even when using a filter. This is possible but requires some clear understanding of how Order of Operations work in Tableau. For example, we can have Departments, and when we filter on Departments to have Top 3 families displayed at all times. Various different dimensions and metrics can be combined to make such incredibly useful analysis. We can create a set to show the top 3 items.

Read more: Excel Data Source in Tableau Online »

Tableau Create Set to show Top N
Tableau Create Set to show Top N

Context Filter Approach

The scenario can be achieved using Context filters. Context filters are a way of simulating a data source filter, but localized to a particular view or views. So, for any given view, the context filter is applied first. Then any other filter acting on that view works as if the data filtered out by the context filter does not exist at all. This is the beauty of a Tableau Context filter and it will continue to return the expected data even we refresh our data. The Context filter will function automatically on the refreshed latest data to return the expected results.

Keep reading: Tableau Desktop Specialist Certification Questions »

Loading RSS Feed

Why Context Filter

Th reason why this method of using Tableau Context Filters will work effectively in our particular business scenario is because the context filter will relocalize our Top N list strictly to data that exists within the Context. Thus giving us the Top N list for that set of criteria. Otherwise without using Context, any filter will scan the entire data set, and create the Top N list, displaying the values that match our filters – hence the original Top N values might disappear as they can be filtered out. Hence it is important to test out our final analysis sheet and dashboard with a few different sets of data before confirming that it is working absolutely robustly.

Keep on Reading: Tableau Data Analyst Certification Questions »

Get our Most Popular Downloads

Download the most popular scenario-based Tableau Workbooks in .twbx format. Used by thousands of Tableau developers and job aspirants every day to improve and fine-tune their CV and Tableau Public profile. Join the largest Tableau Experts Social Group.

Tableau Banking and Financial Dataset Analysis Download
Banking & Financial Dataset Analysis

Financial Domain Tableau Dataset and Analysis. The most important domain in today’s industry. Analyze Key Performance Indicators. Discover Risky and Fraudulent Outliers. Download the Tableau Packaged (.twbx) Workbook. Includes a complete Financial dataset analysis. Enhance your Data Analytics experience with our skilled analysis.

Tableau Healthcare and Hospital Dataset Analysis Download
Healthcare & Hospital Dataset Analysis

Hospital and Healthcare Domain Tableau Dataset and Analysis. A key field of study with millions of lives at stake. The most sensitive industry today. Download the Tableau Packaged (.twbx) Workbook. Understand how healthcare datasets work. Includes a complete Healthcare dataset with analytical charts. Explore Tableau interactive features with this download.

Tableau Insurance Dataset Analysis Download
Insurance Dataset Analysis

Insurance Domain Tableau Dataset and Analysis. Important domain specific metrics and data. Learn how to visualize important metrics. Show outliers and insightful data points. Download the Tableau Packaged (.twbx) Workbook. Includes comprehensive analysis of Insurance data of a large sample population. Uses industry standard analytical practices.

Tableau Practice Test

The best Tableau practice exams built. Period. Explore definitive practical problems created by brilliant Tableau experts.

Get in Touch

Contact Us
Write for Us

Published by Rahul Bhattacharya

Rahul is a journalist with expertise in researching a variety of topics and writing engaging contents. He is also a data analyst and an expert in visualizing business scenarios using data science. Rahul is skilled in a number of programming languages and data analysis tools. When he is not busy writing, Rahul can be found somewhere in the Appalachian trails or in an ethnic restaurant in Chicago.

One thought on “How to create a Set to show Top 3 even when we filter?

Leave a Reply