Filters in Tableau
Tableau is one of the best data visualization tools in all BI tools in the world. Its capability to yield robust insights and interactive dashboards makes tableau easier for even non-techies to have access to personal or business datasheets to analyze.
There are different types of filters in Tableau to filter individual views as well as even entire data sources on dimensions, measures, sets or groups, etc. Filters help to restrict the data from the database and help to find out different exact stories in the data. Filters are useful to filter the large data sets in Business Intelligence and prepare data for faster analysis just by reducing the size of data. Overall, the filters are helpful to make data insightful, readable, and actionable format.
Types of Filters in Tableau:
- Extract Filters
- Data Source Filters
- Context Filters
- Dimension Filters
- Measure filters
- Quick Filters
Extract filters are applied at the time of data feeding to the tableau. That is before pulling data into the tableau we need to restrict unwanted data and reduce the size of the data feeding into the tableau we can apply filters to the data extract by using certain dimensions and measures.
On the Tableau connection page where we choose extract, there are Filters to edit option given. If we click on the Edit option here, we will get the window to apply filters by using specific dimensions or measures. Also, when we extract the data by using the Extract button, a window pops-up, where we can apply filters as well as how much data to be extracted into the tableau.
So, this is all about Extract filters in tableau.
Data Source Filters
This filter works similarly to the extract filter. After connection establishes with data, all the source data is filtered by using the data source filter in tableau.
The data source filters can be applied in live connection as well as extract data source connection.
Data source filters are used to restrict sensitive data. One thing to remember about tableau extract and data source filters are not linked that is if you change the connection from extract to live then the data source filter will be in place as it is.
Context Filters in Tableau
Context filters are the independent filters while all other filters are the dependent filters. The context filters are independent as they process the only data which is passing through the context filter. We can create a context filter to improve performance.
We can create this filter just by dragging the dimensions or measures into the filter’s shelf and right-click on the field. There is an option to add a filter into context. Click on ‘Add to context’. Now Tableau will generate a temporary table in the background and the next filter will be applied on this temporary table but not the total data source. There will be a small amount of data to be filtered out or to be work on. So that the processing time for data will be reduced and it will be performed faster as compared to other filters.
Points to remember about context filter:
- Context filter appears at the very first on the filter shelf.
- Its color is grey.
- We cannot rearrange the filters with context filters.
Follow the below rules to improve the performance of the context filter:
- Use a single context filter which reduces the size of the data, rather than by applying multiple context filters.
- Before applying the context filter, try to complete your entire data modeling.
- Continuous dates should be used.
- Create the context by applying necessary context filters before adding fields to other shelves.
- The context filter could not be changed by the end user. If the filter changed, then the temporary table will be recomputed and rewrite, slowing performance.
- Whenever you add a filter into context, Tableau will create a temporary table at the background always. And it will get loaded every time when view refreshed. This may cause performance issues.
Dimension filters are applied by simply dragging and dropping the dimensions, groups, sets into the filter pane or by right-clicking on the specific dimension, and selecting Show Filter.
We can choose to only show the things highlighted or just by clicking the exclude checkbox. It will instead filter out the Dimensions selected, and it will be strikethrough. If you want to add all dimensions into the filter, then click on All or None to deselect everything and then select whatever you want from the data.
In the filter window, we can see there are three tabs for wildcard, condition, top. Here we can choose if we want to show top N values by a certain dimension or measure with the help of a parameter.
Filters can be edited just by right click on it and click edit filter.
Measure filters are aggregated filters that are applied after non-aggregated filters. This filter also can be applied by just dragging and dropping the measured field into the filter pane. Once you dragged the field into the filter shelf it will ask you how you want to filter the data or that means what aggregation you want to use while applying the filter, if you want SUM, AVG, Median, Standard Deviation, etc. If nothing is chosen, then it will automatically be aggregated by SUM. Then after that, you will get a second window pop up which has options like Range of Values, At least, At most, Special, etc. You can either drag or type in the number you want to filter on. If you want to add Null values, then Special can be used.
Quick filters are those filters that are quickly available in tableau just by right click on the dimension or measure.
With the assistance of those filters, you’ll be able to have enough functionality to resolve the common filtering needs. But, it may affect your loading time. which is why it’s recommended to use caution while operating quick filters, and to not add more quick filters to a sheet or dashboard.
Now, we will see How to create Quick Filter in Tableau?
- Drag the required measure or dimension into the filters card.
- Then, as per your requirements or business conditions, apply your filtering.
- Hit the drop-down button or right-click by selecting the filter field and click Show filter, which will make your filter visible on the Dashboard.
There are multiple Quick Filters in Tableau like-
If you are filtering dimensions, then you need to select the following filter options:
- Single Value (List)
- Multiple Values (List)
- Single Value (Dropdown)
- Multiple Values (Dropdown)
- Multiple Values (Custom List)
- A single value (Slider)
- Wildcard Match
If you are filtering measures, then you need to select the following filter options:
- Range of Values
- At Least
- At Most
- Relative to Now
- Browse periods
So, almost all the filters are covered in the above description. Now we will see how we can format these filters in tableau worksheets or Tableau dashboards.
Please follow the below steps to format your filters in tableau to make your dashboards or reports interactive.
- Connect to the data source which you have and create a chart just by dragging the category and sub-category into the rows shelf.
- You will see the bar chart as below image. Now, right-click on the category and select Show Filter, we will see the below view:
- This is the filter applied to the category field. Now we want to format this filter. Click on the arrow next to the filter shelf and select the ‘Format Filter and set controls’ from the list. As shown in the below image.
- After click on the format option we can see a formatting window coming on the left side of the screen.
- Now, we can change the options here to format the filter shelf. In the Title, there are some options to change the font and alignments.
We can change the font, bold, italic, underline, the color of the font, etc. here. The changes will not have occurred in the worksheet, but we can see the formatted title in dashboards.
The formatting done in the Body part will be reflected in the worksheet itself. We can see what changes we have done in font, background, etc. in the sheet itself.
This is what you see in the formatted filter in Tableau dashboards.
If we want to edit the only title but not the body, then Right click on the filter shelf and select Edit Title. The window to edit the title can be seen below image.
If you don’t want the changes you made above, and you want the original formatting of your filters then just click on clear. So that all the changes you made will be flushed.
There are many formatting options available in the tableau filter.
We can enable the apply button to the filters just by right click on the filters shelf then click on Customize and then click on Show Apply Button.
Now we can see the Apply and cancel button appears on the filter shelf as below image.
Filters in Tableau is one of the vast topic but in this article, we have tried to cover almost all filters and the formatting we can do on filters to make it interactive and useful.