Introduction
Filters are an inseperable part of our daily life. Starting from the morning coffee to the air we breathe gets filtered. Similarly, filters are one of the most important and efficient tool in tableau data analytics too.
Objective
By the end of this article, you will be able to understand the various levels of tableau filters, along with a basic idea of how to use them
Types of Filters
Tableau filters are classified based on the level at which they operate. Below is the 6 main types of filters which are executed in that order by tableau.r
Extract Filters
Data Source Filters
Context Filters
Dimension Filters
Measure Filters
Table Calculation Filters
Extract filters, as the name suggests are filters that are applied at the time of data extraction, which is the first and most important step of any tableau work you do. By using filters at the extract level, you are extracting only the data that you need, while also putting the load on the data servers under control. Another good advantage is that the lesser the data, the faster the visualizations. Here is a screenshot of where you can create extract filters:
Data Source Filters
Data Source filters are filters that can be applied after connecting to /extracting the data and before starting the visualizations. Compared to Extract level filters, these filters give the flexibility of reverting back to original data. These filters come in handy when you know that you will need to make same visualizations for different sets of data. Like in our current example, we can filter data for a specific region and come back to switch to a different region any time. The option to add these filters is on the data source tab at the top right corner
Context Filters
Tableau applies all filters at the same level independently. Let's look into it with an example. We have a simple viz which displays the total sales by state and region. Now if you want the top 10 states, then you would apply a "top 10" filter on state (we will discuss what this is when we separateget to dimension filters, but for now follow the example) this is how it will look like
Now if we want to get the top 10 states for the "South" Region, naturally we would go ahead and select just the south region on the checkbox option we have. But then because tableau works on filters independently, our view would be messed up at this point.
As you can see, this data is a common data of the "Top 10 states group" and the "South Region group". What can we do to fix this issue? This is where Context filters come in handy. If we look into more detail of what we want, we are supposed to first seperate states for South region and then get the top 10 states within that region, which is simply to go precedence to region filter over State filter. So, we can do this by selecting "Add to context" feature for the Region filter. This is where you set it.
By doing this the issue is automatically taken care of. If you now look at the viz, it shows the right data. Also, notice that the Region filter is now highlighted in a different color, because it is now a context filter, meaning the first one to be executed after all the data filters are executed.
As powerful as context filters can be at times, we need to use them carefully. so that they do not become counter-productive in terms of performance of the viz.
needs
Dimension Filters
Dimension filters are filters that are applied on Dimensions (blue capsules). There is various kinds of filter options available to use for dimensions. To apply a dimension filter, simply drag the dimension from the left side panel into the filters card, which results in opening a window, as below.
While most of the options are self-explanatory, there is 3 options that need to be elaborated a little. Let's see: 1. "Condition" tab in this window helps you to filter specific values based on another aggregate field in your data. Like States where sales are greater than $1000. Or customers where profits are on the negative side. 2. "Top" tab is similar to the condition tab, but lets you filter the top/bottom "n" number of records for the aggregation in the context 3. "Exclude" option defines whether the selected list of values is supposed to be either included or excluded from the viz.
Measure filters
Measure filters are applied on the measure data fields (Green pills).
As you can see, dimension filters are totally different from measure filters. these are totally based on numbers functions. and since there is probability of them to be in a range, the filter options are available accordingly. Apart from conditions that can applied on aggregates and Standard deviations, there is the "Attribute" option, which leads us to the below window where the filter gets applied directly on the continuous number range.
Table Calculation filters
These are filters that are applied oton calculated fields. They are also called "Late filters" because they get applied at the later part. After all the dimension and measure filters get applied table calculations are done. And then the table calculations are applied oton the resulting source of data. Apart from the fact that they get applied later, they behave the same as dimension and measure filters, based on what data type that is returned by the calculated field. For an a example if you want to create a filter on YearlySales field, then it will become a measure filter and if you want to create filter on "CaliforniaandOther", which returns either "California" or "Other", then it becomes a dimension filter.
This completes the discussion about the types of filters, including the level at which they get executed However, another part that needs a special mention is the "Date" filters. As the name suggests, it is on the date type fields. There are a whole different set of options available for the same. Based on the way you use the data field in your viz, it will either be converted into a dimension or measure. For example, if you use just the "Month" part then it becomes a dimension and if you use the date of the month like the 10th or 13th etc, then it will be a measure. Based on which type you use, there is a very big set of options available to play around with date filters.