The filters that we created in the previous recipe were created on the fly and are not available for later use, meaning each time we want to use the 12 product Sub-Categories that were shown as an output in the previous recipe, we will have to recreate the filters all over again. This becomes cumbersome and it would be great if we could save the output of the filtering conditions and simply drag the new field whenever we need to analyze it rather than repeating all the steps that we followed in the previous recipe. Luckily, we have Sets in Tableau to do this for us.
I like to call Sets as Pre-computed filters which can be used for the creating a sub-set of the data and/or saving the filters for later use.
To create Sets, we will continue working in the same workbook and use the Orders
data from the Sample - Superstore.xlsx
dataset for the following recipe.
Sets
.5
and select the field Sales in the next dropdown and keep the aggregation as Sum. Refer to the following image:As mentioned earlier, Sets are like pre-computed filters. However, we can decide whether we want to use the Set as a Filter or use it for categorizing our data. By default, the Set acts as an In / Out set where it creates two headers: In and Out. These are like True (included in the result) or False (excluded from the result) values where if we put the Customer Name next to the Set in the Rows shelf, it will categorize Customer Name into two groups: customers that are In the Set, that is, customers who are among the Top 5 customers by Sales list, or customers that are Out of the Set, that is, customers who are not among the Top 5 customers by Sales list. Refer to the following image:
In this case, there is nothing that is getting filtered out. All the customers are shown and they are simply clubbed under either the In or the Out header. However, when use the option as Show Members in set, we are only getting the names of the customers that are part of the Set. The rest of the customers are filtered out.
Further, we can also create two sets and combine them. For example, we can create one set as Top 100 customers by Sales and another set as Bottom 100 customers by Profit. Refer to the following image:
Once we have these two sets, we can Combine them by doing an Ctrl + Select and then right-click to select the option of Create Combined Set…. Refer to the following image:
We will then see a new dialog box that shows the multiple ways in which we can combine our two Sets. Refer to the following image:
The options of combining two sets are as follows: