Preparation time: 5 minutes
Level of difficulty: Easy
Objective: Understanding context filters
Context filters in Tableau allow you to organize your analyses hierarchically, a crucial function when it comes to creating accurate rankings.
By default, all filters in Tableau are applied independently, meaning they don't take into account other active filters. So, if you want to, for example, show the top 10 subcategories in a specific category, classic filters do not allow you to do this directly.
Context filters solve this problem by allowing you to set a priority. : you can filter by category first, then get a precise ranking of the sub-categories within this selection. A bit like prefiltering data before normal filters.
The view is filtered, but only 3 products are shown instead of the expected 10. This is because, by default, each filter is evaluated independently, and the view only shows the intersection of the results. So this view shows the three of the ten top-selling products that are in the Office Supply category.
To display the top 10 sales by sub-category for a given category we will use a context filter.
The view now shows the Top 10 sellers by subcategory for the Office Supply category.
Don't overuse context filters. Excessive use of them can increase performance and introduce unnecessary complexity. Use them in a targeted manner, and only when a clear filtering hierarchy is needed or performance gains are expected.