JESWIN GEORGE

Logo

DATA ANALYST
Download my resume
View My LinkedIn Profile
View My Tableau Public Profile

View My GitHub Profile

Working with sets in Tableau

Sets in Tableau are used to create subsets of data based on certain conditions defined by the user. Types of sets: dynamic set, fixed set and combined set. In Tableau, sets can only be created based on dimension fields.

Here the following topics will be covered:

  1. Creating a dynamic set
  2. Creating a fixed set
  3. Create a combined set
  4. Using set actions to make sets more dynamic and interactive

Global superstore orders Data used for this blog can be downloaded from here

1. Creating a dynamic set

The members of a dynamics set changes when there is a change in the underlying data. Dynamic sets can only be based on a single dimension.

Lets try to answer the question - Show the top 10 Products which has the maximum sales.

  1. In the Data pane, under Dimensions, right-click the field Product Name and select Create > Set.
  2. In the Create Set dialog box, configure your set. There are 3 tabs to aid in configuring the set:
    • General Used to select one or more values that will be considered when computing the set. Usually the Use all/Custom value list option is used to consider all members of the dimensions and later the condition/top tab is used for selecting the filtered or required member. general

    • Condition Use the Condition tab to define rules that determine what members to include in the set. Set conditions work the same as filter conditions.
      Example: Condition to select only those products which has profit more than $4000. (Wont be using this tab’s conditon in the main question defined above) condition

    Now following with the question, set condition to None. condition

    • Top Use the top tab to define the limits on what members to include in the set.
      top
  3. When finished click OK. The new set is added to the bottom of the Data pane, under the Sets section. dynamic_set

  4. Now lets observe the effect of sets. Drop the Product Name dimension to the rows shelf. And drag measure Sales to the Text in marks card and we get total sales for each Product. Then drag the set Top 10 Products with max sales to the filter and we get the top 10 Products which has the maximum sales. observe

  5. Now select only the Country - India using filter and observe the change in the Products along with the their sales value. We get the top 10 Products sold in India. India

2. Creating a fixed set

The members of a fixed set do not change. A fixed set can be based on a single dimension or multiple dimensions. This is particularly useful when we want to focus particularly on selected memebers of considered dimensions.

To create a fixed set:

  1. Select required values of a dimension Product Name. And then either right click on selected values or on hovering we will get the follwong box with an icon for Create set with Name Interested Products.

setf

  1. Checking the Exclude option will exclude the selected members of the dimension from the set. Can also directly send the set to filters shelf by checking the Add to filters shelf. Then click OK to create the set. The new set is added to the bottom of the Data pane, under the Sets section.

setf

  1. Example - To see the sale of our interested items in the different regions of sale of global superstore. setf

3. Creating a combined set

To see the states which are in the top 10 of both highest sales and highest profits.

  1. Created a set which has top 10 states with the highest sales in US- highest_sales

  2. Created a set which has top 10 states with highest profits in US- highest_profit

  3. Resultant sets in the sets section resultant_sets

  4. Right click on either of the 2 sets and select create combined set. combined_sets

  5. Combined set creation dialog box dialog_box

  6. Result of combined set has states common to both in the sets with combined_set

4. Using set actions to make sets more dynamic and interactive

set_action_ref

Image source: Tableau blog - 8 ways to bring powerful new comparisons to viz audiences with Tableau set actions

With Set Actions, it is possible to dynamically pass dimension values to existing sets based on value selection from other visualizations by user. Like parameters, set action allows user to control different aspects of analysis.

With Set Actions implemented, the values in the Set, change based on the selection from source sheet.

A set can apply different behaviours to various target sheets. For example, the same set could colour viz A, hide data in viz B, and filter an axis in viz C. Now with set actions, a user selection in any of the sheets can update the set, thereby modifying all target sheets in a single coordinated selection.

set_action_fns


Reference:

  1. Tableau help: Create Sets
  2. Analytics Vidhya - Intermediate Tableau guide for data science and business intelligence professionals
  3. Hands-On Guide to Tableau Sets
  4. Using set actions in Tableau
  5. 8 ways to bring powerful new comparisons to viz audiences with Tableau set actions
  6. 8 analytic concepts to express with Tableau set actions