In data analysis, there are advanced tools like Tableau that offer much more bang for your buck, with at least 6 types of filters in tableau for your data set. We are going to discuss each one in detail today. Everybody at some point in time would have dealt with a spreadsheet and would have wanted to just show a certain type of data based on some value in a column. The first thing that you get familiar with is sorting the data set and then move onto filters. So, most of you might be familiar with filters, at least the basic ones that the omnipresent Excel shows you.
Filters are, just to reiterate, conditions that help you display a subset of the data basis one or more conditions, where the conditions can be simple value-based or could be a complex calculation based or based on factors outside the dataset, like metadata. Let’s take a shot at them.
As mentioned, there are several useful types of filters in Tableau. The filter that you choose or the combination thereof really depends on what you would like to limit your data set to. In other words, your business requirement. A simple requirement could be that your manager wants to see a sales data summary for the last month. So here you need two tasks done, limit the data to only last month and then summarize the data well enough.
There are in total 6 types of filters in Tableau, which are,
Let’s dive into the details of each one of these types of filters in tableau.
Tableau allows you to have a data source, either live or an extracted or copied one. Live data source would mean, any changes done in the data source will almost immediately reflect in Tableau. Extract, on the other hand, is a copy of the original data and will not reflect any changes made to the data source unless you decide to reload the data once again after the changes to the original data are saved.
During the extraction of data, Tableau allows you to add filters to the columns being extracted from the data source. You could filter out columns based on whole columns or values within the column(s). A small and quick example might help put things in perspective.
You could connect any flat file containing data in rows and columns, or what we call tabular format. In our example below, we are selecting the sample file, Superstore, that comes with Tableau.
Click on the Extract radio button as shown below.
This creates a local copy in the Tableau repository.
No click on the Edit button right next to the extract option, as shown below.
A dialog box will pop up with the option to add a filter criterion. You can add more than one criterion. When you click on add, you will be presented with the Add Filter window, as shown below.
With a choice of all the columns listed in the window, you may choose to select any one of the columns relevant to your business case. For the purpose of this example, let’s select Category and select OK.
Another window pops up with a selection of values within the selected column. You could then select any particular value and either choose to include or exclude (option at the bottom of the list on the right).
A data source filter applies the filter to the data source directly, enabling quick uploads of data that qualify into the Tableau workbook. To add a Data Source filter, select the Data Source page or tab in Tableau. From the given sources right click on the applicable data source and select Edit Data Source Filters. Click on Add to bring up the Add Filter dialog box, which lists the fields in the selected data source. Now Select a filter and proceed just like the way we did with Extract filters.
Data Filters are primarily used to restricting data that is available to users when the workbook is published.
Context Filters are used to improve performance of views, filters, and queries run on a data source. All filters by default are applied independently of any other filters in Tableau, which means each filter accesses the entire data set without regard to any other filters. A context filter can be applied to change this behaviour. You could have a context filter that is run before any other filters, and the rest of the filters are applied on top of the data returned after context filtering.
To create a context filter, click on Add to Context on the contextual menu of any existing categorical filter. The context is computed first, generating the view. The rest of the filters are then computed over the view generated by the context filter.
Dimensions in Tableau are fields that are independent, typically any field that contains categorical or qualitative information. Filters applied on such dimensional data are called Dimension Filters. You can choose any of the dimensions listed by Tableau for your data, drag them to the Filters box. The members or values of the dimension are displayed. You can choose to select or deselect these members completely or use wildcard selection or even a condition-based selection where you can use complex formulas or simple conditions to filter out data.
Filters that are applied to a measure filed are called Measure Filters. Measures are typically fields that contain quantitative data. To add a measure filter, you could drag a measure filed into the Filter box. In the resulting Filter window, select desired aggregation and click Next. The window that pops up allows you to further narrow your filter using, Range of values, At Least, At Most and Special sub filters. Here are a couple of screen grabs that show the same.
Depending on the type of file that you have chosen to filter on, Tableau presents a Filter dialog box. For dimensional data, Tableau will automatically list the categories for selection or deselection from the data set as shown below.
When you click on Custom value list, Tableau allows you to added one or more categories to make a custom list of categories.
The Wildcard page will let you filter in or out data based on values of dimensions. Conditions like Contains starts with and Ends With help you narrow down the dataset.
The Condition tab on the Filter dialog box, lets you filter in data by specifying several conditions values within the measure fields.
Finally, you can also select data by specifying a formula as a condition. Select the By Formula option under the Condition tab. A formula can be typed into the box below that specifies your custom condition. For example, SUM(Sales)>10000.
All the filters mentioned above are the different types of filters in Tableau. Filters can be applied in a number of ways within Tableau. The more upfront the filters are applied, closer to the data source the better the querying experience and performance, especially when with massive data sets. Also, you should be careful with filters on the data source or context filters as they might hide data that might be actually useful for analysis.
If you are interested in making a career in the Data Science domain, our 11-month in-person Postgraduate Certificate Diploma in Data Science course can help you immensely in becoming a successful Data Science professional.