Additional Filtering Topics
Additional Filtering Topics
Filtering in Tableau is incredibly powerful, but with that it can get complicated. This video
assumes a basic understanding of filtering as laid out in the previous videos and goes
beyond into some deeper concepts.
Context Filters
First is Context Filters. One thing to note about the filter shelf is that the filters are
computed independently of each other. If a given filter will trim the dataset down, it may
be worth Adding to Context. A Context Filter will be computed first, then all other filters
will run only on its results.
For example, if we knew that we only wanted to look at products within the Machines
sub-category, we may want to make that a context filter by right clicking and selecting
“Add to Context”. The filter is now grey, and any subsequent filters will only be on
machine products. Context filters are generally best to use when they’ll return a
significantly smaller set of results, the guideline is about a tenth or less of the original
data. Context filters ideally shouldn’t be something that would change frequently, so let’s
hide this interactive filter.
Apply to Worksheets
When a pill is placed on the filter shelf, by default that filter applies only to the current
worksheet. If it makes sense to have the filter applied more broadly, we can change the
scope by clicking the pill’s dropdown chosing, “Apply to Worksheets” and applying
the filter to “All using related data sources”, “All using this data source”, or “Selected
worksheets”.
This can be especially useful on a Dashboard, where a filter that is relevant to multiple
views can be set to apply to all or some of them simultaneously. By default, the
interactive filter only applies to the view it was brought out with. But if we go to the
menu and say “apply to worksheets” > “All using this data source”. Now all the views
filter.
And not just the views on the dashboard. Let’s build a new sheet. We’ll double click
Sales and double click Category. In the view, note that we only have one Category. But
fortunately, we get this visual indication here that a filter has been applied. This icon
2
lets you know there’s a filter on the data connection, so we can backtrack and hunt it
down if that’s not what we want. Another solution would be to say “Apply to worksheets”
“selected worksheets” and target just the ones we want to have filter. It’s important to
note that taking an “applied to all” filter off the filter shelf removes it from all views, not
just the one we’re looking at, so be careful when using this option.
Alternatively, we could bring Customers to the filter shelf and use the condition tab to
say we only want customers who have sales greater than 10 000. We have the same initial
12 rows, and if we again break it out by Category we still have 12 rows. No customers
were filtered out like they were last time. Here, Tableau ran Customers by their sum of
sales through the filter, then any who had more than $10,000 were put into the view,
regardless of how the Categories split up those sales. Knowing how we set up our filter
will impact how we can manipulate the view and maintain the filter as we designed it.
Filters created during the Extract process limit what data is brought into the extract
itself. Then, Data Source filters are applied, limiting what is made available in Tableau.
Once the data is in Tableau, Context Filters are applied first and all subsequent filters are
run against their temporary table of results. Filters involving FIXED LOD expressions are
3
evaluated next. Then filters on dimensions (like ship mode). Then INCLUDE or EXCLUDE
LOD filters. Then filters on measures (like shipping cost). And finally Table Calculation
filters, which are applied last (because these are performed only on the data in the view).
Some things to consider about filtering and its impact on performance: Context filters
are slow to create or change due to the temporary table being created behind the scenes,
but once they are in place they can increase performance since further queries are only
run off a subset the subset of data as opposed to the entire data set. Cascading interactive
filters can help narrow down the list of options, like here, we only see states that are
in the country we selected. However, when a filter requires Tableau to find all potential
field values, this requires a complex query that can take time to evaluate. Here, using a
wildcard may be more performant. The presence and maintenance of indexes in the data
source can dramatically improve filtering performance.
Conclusion
Thank you for watching this additional filtering topics video. We invite you to continue
with the Free Training videos to learn more about using Tableau.