Sign in or start a free trial to avail of this feature.
3. Context Filters
Context filters provide much better performance than quick filters and are especially useful on dashboards that contain multiple filters.
To explore more Kubicle data literacy subjects, please refer to our full library.
- Context filters can improve the speed and performance of your Tableau dashboards
- Context filters are applied in the view and are performed before any other Quick filter
- Try to apply context filters to the dimension/measure that will reduce the size of the dataset the most
Additional tips when using context filters
- Use only a single context filter if possible
- Complete all your data modelling before applying a context filter
- Create the context filter first before adding fields to other shelves
- Date filters work best if they are set to discrete values such as MONTH
In this lesson, we're going to move from low-level filters, such as extract and data source filters to new filters that are all created in the view.
The first of these are context filters, and context filters are all about performance. So let's find out how they work.
When we create filters in a view, we simply drag the dimension or measure into the filters card. The pills and the filters card are colored either blue or green. Measures are colored green, and dimensions are colored blue.
Filters as a rule in this scenario are independent. They all query all the rows and the extract, without regard for the other filters. Needless to say, this can reduce the responsiveness of the visualizations, particularly if you have a large data set, and you want to use a lot of filters.
Any other filters that you set are defined as dependent filters, because there process only the data that passes through the context filter. So let's set one of our filters as the context filter. And to do this, I simply select the drop down and add to context.
And when this happens, we see the context filter moves up to the top of the filters card and changes color.
Now all of our other filters with pass through the revenue filter first.
To remove the context filter is also very easy. Simply go back to the drop down and click remove from context.
If I want to make another filter the context filter, I simply create a drop down and add to context.
To ensure that you get the performance boost from context filters, it's worth following a couple of general rules. The first of these is to use a single context filter, if at all possible. If a filter does not reduce the size of a data set by say one 10th or more, then it's actually worse to add it to the context because of the performance cost of computing the context filter.
So always apply the context filter to the variables that you think will reduce the data set the most.
The next step is to compute all your data modeling before applying a context filter.
If you apply a context filter before you've completed your data modeling, the context filter will have to recalculate each time that you make a change.
It's also worth setting your context filters before adding fields to other shelves. Doing this work first, we'll ensure that the queries you run when dropping fields onto other shelves are much faster.
And lastly, if at all possible, try to ensure that date filters are set to discrete values rather than continuous. discrete values such as month, year and week give you a huge performance boost over continuous values on each day.
As I said at the beginning, context filters are really about performance. If you're using small data sets, and don't notice an Eloading problems with your Tableau workbook, you can probably ignore them. However, if you are seeing some delays, try experimenting with context filters to see if you can see that performance boost.