Tableau Sets are custom fields that are created based on dimensions from your data source. In real-time, you can create a set by selecting members from the list or a visualization. Conditional logic can be used to identify what is included or excluded from a set using either dimensions or measures. Tableau Sets can be used in a variety of ways. We can create a Set for a particular group of data that meet a certain condition and compare them with the data that is not in that group (IN/OUT). For instance, we can create a set of least profitable products or we can create a set of offices that are lagging in sales.
Types of Sets:
There are two types of Sets in Tableau: Dynamic Sets and Fixed Sets
Dynamic Sets:
As the name suggests, the values/members in the dynamic sets get change when the underlying data changes. Dynamic sets can only be based on a single dimension.
To create a dynamic set:
Step 1: Click on the dimension on which we want to create a set and select create set option.
Step 2: In the create set window, we have three ways in which we can create the set.
General: General option provides us the option to select from list where we can manually select the values as per our requirement. We can also search the values from the Custom value list and can also select all the values by clicking the Use all option. Whatever values we select will be included (IN) in the set and the remaining values will be considered (OUT) outside when the set is being computed.
Condition: Condition allows us to choose the values based on some condition. For instance, we can create a set of Product IDs whose sum of sales is greater than or equal to 150000.
We can even create the set based on the formula. For example, we can select only those products in the set whose sum of sales is greater than or equal to 150000 and less than or equal to 500000.
Top: Use the Top tab to define limits on what members to include in the set. For example, we might specify a limit that is based on total sales that only includes the top 5 products based on their sales.
Step 3: When finished, click OK.
The new set is added to the Data pane. A set icon indicates the field is a set.
Fixed Sets :
The members of a fixed set do not change, even if the underlying data changes. A fixed set can be based on a single dimension or multiple dimensions.
To create a fixed set:
Step 1: In the visualization, select one or more marks (or headers) in the view.
Step 2: Right-Click the marks and create the set.
Step 3: Enter the name of the set in the create set dialog box and click OK.
Step 4: Optionally we can select any of the following:
By default, the set includes the members listed in the dialog box. We can select the option to Exclude these members instead. When we exclude, the set will include all of the members we didn't select.
By clicking the red "x" icon that appears when hovering over a column heading, we can remove any dimensions that we don't want to be considered.
By clicking the red "x" icon that appears when we hover over a row, we can remove specific rows from the set.
We can specify the character that separates the dimension values. To do so, Separate members by, entering a character of our choice.
Select Add to Filters shelf to automatically move the set to the Filters shelf once it is created.
To add or remove data points from a set:
In the visualization, select the data points you want to add or remove.
To add or remove data from a particular set, click the Sets drop-down menu icon, and then select Add to [set name] or Remove from [set name].
Combined Set
You can combine two sets to compare the members. When you combine sets you create a new set containing either the combination of all members, just the members that exist in both, or members that exist in one set but not the other. To combine two sets, they must be based on the same dimensions. Let's understand it with the help of an example.
Step 1: Drag profit to rows and sub-category to columns. Click the sub-category and select create a set.
Step 2: From the Create Set window, click the By field option and select Top 3 products based on the sum of profit. Click OK
Step 3: Similarly create another set and select the bottom 3 sub-categories based on the sum of profit.
Step 4:Now we have two sets, Top Sub-category, and Bottom Sub-category. Now we will create a combined set.
Press the ctrl button and select both sets. Then click one of the sets and select create Combined Set.
Step 5: In the Create Set window, give the name for the combined set. then choose the ways we want to combine the two sets. Select one of the following options for how to combine the sets and then click OK:
All Members in Both Sets - the combined set will contain all of the members from both sets.
Shared Members in Both Sets - the combined set will only contain members that exist in both sets.
Except Shared Members - the combined set will contain all members from the specified set that don't exist in the second set.
Step 6: Drag the combined set to the columns. Click on the set and select Show Members in Set
Step 7: Drag any of the Top Sub-category sets or Bottom Sub-Category sets and put it on the Color in Marks card.
The visualization shows the Top 3 and Bottom 3 subcategories based on the sum of profit.
Conclusion
Tableau Sets are dynamic and valuable features that you may employ to give your report more interaction and versatility. It’s a powerful tool in your arsenal that can be used for both calculations and visualizations. In this article, you learned about Tableau Sets, the different types, and how to create and use them.