Tableau Data Analysis: Context Filter

TABLEAU / POWERBI

Vanessa Gottardi

2/18/20244 min read

Explore the world of context filters in Tableau with our latest blog post! Learn the step-by-step process of setting up context filters, editing them for optimal results, and seamlessly removing them when needed. Whether you're a Tableau enthusiast or a data analyst, this post provides valuable insights into harnessing the power of context filters for enhanced data exploration and visualization.

context filters in tableau
context filters in tableau
What are Context Filters in Tableau

Context filters in Tableau are a crucial feature that allows users to filter data based on specific criteria, optimizing performance, and enhancing analysis.

Here's a concise overview:

Functionality: Context filters come into play after extract filters and data source filters in the hierarchy, acting as the first filter applied to a worksheet.

Data Reduction: Context filters reduce the dataset available in the visualization, limiting the underlying table in the worksheet.

Independence: Unlike normal filters in Tableau, context filters can access all rows in the data source without regard to other filters.

Creation: Users can create a context that includes multiple filters by selecting Analysis > Set Context and adding the desired filters.

Performance Optimization: Implementing context filters helps improve performance by focusing on relevant data.

  • Example:

Suppose you have a dataset with sales data for various products and want to analyse the performance of a specific category. You can use a context filter to focus on that category, improving performance and streamlining the analysis.

  • Additional Example:

If you're analysing sales across different regions but want to concentrate on a particular region, a context filter can efficiently narrow down the dataset to the selected region.  

How to Create Context Filters in Tableau

If you want to follow this tutorial, access Superstore data at Tableau Public here.

To start, let’s display the sales for all subcategories by placing sales into columns and sub-category into rows, sorting highest to lower sales.

how to create context filter in tableau
how to create context filter in tableau
How to Create the Top 10 Selling Products Filter in Tableau

Drag sub-categories into filters, which will open a filter window -> top -> by field: top: 10 -> sales: sum -> ok.

how to create context filter in tableau
how to create context filter in tableau

The result is a bar chart with the top 10 most sold products.

how to create context filter in tableau
how to create context filter in tableau

To elaborate it, we can create a filter for only one product category: furniture.

Same step, drag category into filters -> check only furniture -> ok.

how to create context filter in tableau
how to create context filter in tableau

The bar chart is reduced into only 3 products under furniture category.

how to create context filter in tableau
how to create context filter in tableau

The chart shows the 3 products under furniture category that are among the top 10 products.

To find out what top 10 furniture products are, we need to make the category filter a context filter by right clicking on category in filter -> add to context.

how to create context filter in tableau
how to create context filter in tableau

After that, we can see that category is marked as context filter and the bar chart shows the top 4 furniture products.

It happens because we filtered to show only furniture category.

Notes:

  • Context filter will appear on top of the filter.

  • Identified by a grey colour.

  • It can’t be rearranged in the filter shelf.

  • For this example, category is set to be the context filter and sub-category is using only the data that passes through the furniture category.

How to Improve Performance of a Context Filter in Tableau

To enhance the performance of a context filter in Tableau, follow these tips:

Reduce Filtered Data: Context filters are most effective when they reduce the filtered data to 40% or lower, significantly improving performance.

Proper Use of "Add to Context": When applying filters to large datasets, using the "Add to Context" feature can improve performance by optimizing the filtering process.

Minimize Changes: Context filters perform best when they are not changed frequently. Avoid frequent modifications to maximize their impact on performance.

Combine Filters: Consider combining multiple filters into a single context filter for better efficiency.

How to Edit a Context Filter in Tableau

Click on the dropdown menu of the context filter in filter shelf -> edit filter.

how to edit a context filter in tableau
how to edit a context filter in tableau

In this window, we can change edit the context filter.

How to Remove a Context Filter in Tableau:

Simply click on the dropdown menu of the context filter in filter shelf and select remove from context.

how to remove a context filter in tableau
how to remove a context filter in tableau

Category will remain the filter shelf, however, it’s not a context filter anymore.

It was short overview of context filter in Tableau.

Hope you enjoyed it and learned new things :)

Related Stories