05 Dec 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:
- Drag a dimension to the Filters shelf.
- Right-click the dimension and select “Add to Context”.
- 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:
Now, drag the Sub-Category to the Filters pane. On dragging, the Filter window will open:
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:
After clicking OK above, now the top 5 sub-categories by Sales Sum are visible and the horizontal bar chart has also been updated:
Drag the Dimension Category to the Filters pane. After dragging, a new Filter window will open:
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:
It will now show two subcategories of our category Office Supplies. The Filters pane is also showing the Category: Office Supplies:
Now, let us add to context. Right-click the Category: Office Supplies, and click Add to Context:
Now, the subcategory of products from the category Office Supplies which is among the top 5 subcategories across all the products is visible:
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:
No Comments