Tableau – Context Filters

In Tableau, a context filter is a type of filter that helps to improve performance by reducing the amount of data that needs to be queried. When you create a context filter, Tableau temporarily ignores the filter conditions and aggregates the data at the level of detail of the view.

Here are some key aspects of context filters in Tableau:

  • Performance improvement: Context filters can significantly improve the performance of your dashboard by reducing the amount of data that needs to be queried.
  • Temporary filter: A context filter is temporary and only applies while the filter is being created or updated.
  • Aggregation: When you create a context filter, Tableau aggregates the data at the level of detail of the view.
  • Filter order: The order of filters matters in Tableau. Context filters are applied after dimension filters and before measure filters.

To create a context filter in Tableau:

  1. Drag a dimension to the Filters shelf.
  2. Right-click the dimension and select “Add to Context”.
  3. Tableau will aggregate the data and create a temporary filter.

By using context filters effectively, you can optimize the performance of your Tableau dashboards and provide a better user experience.

Let’s say we need to find the top 5 Sub-Category of products for the category called Office Supplies.

Let us create a new sheet and name it Context Filters in the same Amit_Tableau_Filters.twb Tableau Workbook.

First, drag the Dimension Sub-Category to the Rows shelf, and Measure Sales to the Columns Shelf. After dragging, a horizontal bar chart will be visible displaying the sum of sales with sub-categories:

1. Drag the fields to the Rows and Columns shelf in Tableau

Now, drag the Sub-Category to the Filters pane. On dragging, the Filter window will open:

2. Drag a field to the Filters pane to create a filter in Tableau

Go to the Top tab in the Filter windows. Click the drop-down, and select the option By field. Set the 10 to 5 to get the top 5 values. Keep the rest, Sales, and Sum dropdown as it is, and click OK:

3. Create a filter for sum of sales in Tableau

After clicking OK above, now the top 5 sub-categories by Sales Sum are visible and the horizontal bar chart has also been updated:

4. Filter applied in Tableau

Drag the Dimension Category to the Filters pane. After dragging, a new Filter window will open:

5. Filter dialog box in Tableau

Above, 3 categories and visible in the Filter [Category] windows. Since we want the top 5 Sub-Category of products for the category called Office Supplies, we will select Office Supplies, and click OK:

6. Select a category to filter in Tableau

It will now show two subcategories of our category Office Supplies. The Filters pane is also showing the Category: Office Supplies:

7. Filter for specific category in Tableau

Now, let us add to context. Right-click the Category: Office Supplies, and click Add to Context:

8. Right click to Add to Context in Tableau

Now, the subcategory of products from the category Office Supplies which is among the top 5 subcategories across all the products is visible:

9. Context Filter set in Tableau


If you liked the tutorial, spread the word and share the link and our website Studyopedia with others.


For Videos, Join Our YouTube Channel: Join Now


Read More:

Tableau - Quick Filters
Tableau - Conditional Filters
Studyopedia Editorial Staff
contact@studyopedia.com

We work to create programming tutorials for all.

No Comments

Post A Comment

Discover more from Studyopedia

Subscribe now to keep reading and get access to the full archive.

Continue reading