How To Use Sets in a Visualisation?

After you create a set, you could see it at the bottom of the Data pane in the Sets section. You can drag it into any visualisation like you would with any other field.

When you drag a set to the visualisation into Tableau Desktop, you can choose to show the members of the set or aggregate the members into In/Out categories.

In Tableau Server, one can only aggregate the members of the set into In/Out categories.

You can use set actions to give your audience more control over their analysis of your visualisation.

Set Actions

Set actions take an existing set and update the values contained in that set based on a user’s action in the visualisation. As the author, you can use a set or sets that you have already created to define the scope of the set action.

You could use set actions to let your audience interact directly with your visualisation, even your dashboard. It gives them more control over aspects of their analysis.

Now, you can define the set action to include the following:

  • the source sheet or sheets it applies to.
  • the user behaviour that runs the action (hover, select, or menu).
  • the target set (the data source and set to be used).
  • what happens when the selection is cleared.

How To Create Set Actions?

  1. Go to a worksheet, select Worksheet >Actions. In a dashboard, select Dashboard >Actions.
  2. In the Actions dialogue box, click Add Action and then select Change Set Values.
  3. Specify a meaningful name for the action in the Add/Edit Set Action dialogue box.
  4. Select a source sheet or data source. The current sheet is selected by default. If you select a data source or dashboard you can select individual sheets within it.
  5. Select how users will run the action.
  • Hover runs when a user hovers the mouse cursor over a mark in the view.
  • Select runs when a user clicks a mark in the view. This option works well for set actions.
  • Menu runs when a user right-clicks a selected mark in the view, then selects an option on the context menu.
  1. Specify the target set. First, select the data source, and then select the set.The sets available in the Target Set lists are determined by the data source that you select and the sets that you have created in the workbook that are associated with that data source.In this example, the target set is using World Cup Squads and Groups Extract as the data source and Team Set as the set.
  2. Specify what happens when the selection is cleared in the view:
  • Keep set values makes current values in the set remain in the set.
  • Add all values to set adds all possible values to the set.
  • Remove all values from the set removes previously selected values from the set.
  1. Click OK to save your changes and return to the view.
  2. Test the set action by interacting with the visualisation. Tweak some of the settings for the action to adjust the selection behaviour as needed.

The following examples show just a few of the ways you can use set actions.

How To Combine Sets?

Combining sets allows you to answer complex questions and compare cohorts of your data. 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.

Note: To combine two sets, they must be based on the same dimensions (this means, you can combine a set containing the top customers with another set containing the customers from last year but you cannot combine the top customers set with the top products set).

To combine sets

  • In the Data pane, under Sets, select the two sets you want to combine.
  • Right-click the sets and select Create Combined Set.
  • In the Create Set dialogue box, type a name for the new combined set.
  • Verify that the two sets you want to combine are selected in the two drop-down menus.
  • Select one of the following options for how to combine the sets:
    • All Members in Both Sets enables the combined set will contain all of the members from both sets.
    • Shared Members in Both Sets enables the combined set to only contain members that exist in both sets.
    • Except Shared Members enables the combined set to contain all members from the specified set that don’t exist in the second set.

These options are equivalent to subtracting one set from another. For example, if the first set contains Red, Orange, and Green Marbles and the second set contains Green and Yellow Marbles; combining the first set except the shared members would contain just Red and Orange. The Green Marbles are removed because they exist in the second set.

  • Optionally specify a character that will separate the members if the sets represent multiple dimensions.
  • When finished, click OK .

Applications of Tableau Sets

There are many ways you can use sets to answer complex questions and compare cohorts of data.

How do members of a set contribute to the total?

You may have all kinds of questions surrounding how the members in a set contribute to the overall total.

For example, what per cent of total sales come from repeat customers? You can answer these types of questions using the IN/OUT mode for a set.

How many members of a set exist in another set?

Another common use of sets is to compare subsets of data or cohorts.

For example, you may wonder how many customers that purchased last year also purchased this year. Or if a customer purchased a specific product, what other products did they buy? You can answer these types of questions by creating multiple sets and combining them.

Hierarchical sets and descendants

A hierarchical set filters data to the selected members and all of their descendants. They are unique to multidimensional (cube) data sources and are defined within the data source prior to connecting to Tableau Desktop.