Comparing Sets vs T|F Calculated fields
Sets are similar to a True|False calculated filter that identifies records that are IN vs OUT of the selected set criteria. The same results can often be accomplished simply using T|F filter calculations.
Some significant differences between T|F calculated fields and Sets are:
With Sets, you can dynamically select which records are in or out of the Set. You can’t do that easily with a T|F Calculated field.
Set logic processes before any dimension filters process, like FIXED LOD calculated fields, whereas T|F calculated fields process after dimension filters.
Sets have more functions available in the Tableau Desktop app, but they are still a useful tool in the Web App.
Using Sets in the Tableau Web App
A common way to use sets is to dynamically select a set of data without excluding other data, since the set only states if a record is IN or OUT of the set criteria.
The first step is to create a Set. In this example, create a Set for the Customer field.
Right click on the Customer field and select Create > Set.
Once you have created a Set, there are three methods to select the records for your set.
The Shortcut Menu has options to create a set, add to set, remove from set.
Check the option Show Set to show the set selection list on the right.
Tableau help link: https://help.tableau.com/current/pro/desktop/en-us/sortgroup_sets_create.htm#SetControl
NOTE: The Set field needs to be on the worksheet in some manner in order to show it.
You might mark it as a detail, color, or tooltip to have it on the worksheet.
You can also check Show Filter on the Set field to select records in the set or out of the set.
DataSelf Example: Example 01 Show Set Control - DataSelf Analytics
Create your Set. In this scenario we are using the Customer Set previously created.
Click on the Worksheet Menu and select Actions topic.
Add an Action to Change Set Values when selecting the Customer Set field on the worksheet.
d. In the example below, the Customer Set field is added to the Rows. It’s standard field label is IN/OUT(Customer). When you click on customer records, they are added to the IN group of the Set, based on the action settings. To clear the set selection, click twice on the IN label to first add all records then clear all records.
Using Sets for selective drill-down
With the hierarchy drill-down function, when you expand a hierarchy, it does it for all the records, not just the one highlighted. But you can use Sets to create a drill-down feature that expands only the highlighted record.
DataSelf worksheet link: Example 03 Sets for Drilldown
In this example the Item Class field is displayed on the worksheet. The goal is to double click on a specific Item Class and list all the items in that Class.
Create a Set for Item Class. No Item Classes have been selected to be in the Set yet.
Add the Item Class Dimension to the Rows section of the worksheet.
Create a Calculated field with the formula
If [Item Class Set] Then [Item] Else '' END
This formula states if an item is in the selected Item Class, then show the Item, otherwise display a blank.
In this example the calculated field was named
Item Class - Item.
Item Class-Itemfield to the rows section of the worksheet.
Create a Worksheet/Action to Change Set Values
6. When an
Item Class is click/selected, it is added to the Item Class Set. Then the
Item Class-Item calculated field displays all the Items in the set.