Tableau Set is a custom filed used to hold the subset of data based on some condition. In real-time Tableau, a set can create by selecting members from the list. Or By writing custom Condition or Selecting Top or Bottom few records based on Measure value so on.
Sets in Tableau can be beneficial. For instance, to create the Top 10 States by profit, Sales Amount greater than the minimum threshold, Products with negative profits, etc. In this article, we will show you how to Create a Tableau Set with an example.
For this demo, we are going to use the Super Store sample excel file downloaded from the Tableau website. Please visit Connecting to Excel Files in Tableau article to understand how to connect and extract data from Excel file in Tableau.
Create a Tableau Set Example
In this example, we will show you how to create Tableau Set, Constant Sets, and Computed Sets. First, Drag and Drop the State Name from Dimension Region to Rows Shelf and Profit from Measures region to Columns Shelf.
How to Create Constant Set in Tableau
The Tableau Constant Set members mean fixed, and once created, they don’t change. To create Constant Set in Tableau, Please select the members you want to include in your settings. Next, select the Set Icon present in the tooltip and click the Create Set… option, as shown below.
Once you click on Create Set.. option, a new window will open, as shown in the below screenshot.
- Name: Please specify the Unique name for this Tableau set. Make sure that the name should reflect the set functionality. For now, we named this set as Random 10 States
- Members: Members we selected in our previous step. If you want to remove any member, Please select the member value and click on the cross button
- Add to Filters shelf: Please check mark this option, If you want to add this set to Filters Shelf
Click OK to finish creating our first Tableau Set. From the below screenshot, you can observe that Our newly created Set positioned within the Data pane
Please Drag and drop the newly created set (Random 10 States) from Sets region to Row Shelf. Next, Remove the existing State names from Row Shelf.
From the below screenshot, you can observe that Our tableau report is displaying the In and Out rows only. It is because, By default, Tableau will display the set values as:
- IN: All the members we selected for creating Set will be placed in IN filed. It means 103,620 is the total profit of our randomly selected 10 states
- OUT: Remaining members will place in the OUT fie
To show the state names (or Set members), click on the Dropdown arrow in the upper right corner of the IN/OUT (Random 10 States) member present in the Row Shelf. Next, select the Show Members in Set option from the Dropdown menu
From the below screenshot you can see the State members present in the Tableau Set
If you want to check the States names inside the IN filed and OUT filed then Please, Drag and drop the newly created set (Random 10 Products) from Sets section to Row Shelf. Next, Drag and drop the State filed from dimension region to Row Shelf.
How to Create Computed Set in Tableau
The Tableau Computed Set members are dynamic, and they change when the underlying data changes. To create Computed Set in Tableau, Please select the Dimension on which you want to create your Set, and Right-click on it will open the context menu. Please choose the Create option and then select Set.. option from the context menu
Once you select Set.. option, a new window called Create Set was opened to create Computed Set in tableau. We have multiple options in this window as shown below
- Name: Please specify the Unique name for the Tableau set. Make sure, the name should reflect the set functionality.
- General Tab: Use this tab to select the required members from the available list.
- Top: This is to select all the Top and Bottom few records. For instance, Top 10 or bottom 10 records based on Profits.
- Condition: Used this tab to write the custom condition. For instance, Profit greater than 10000 etc
- All: This select All the available members from the list
- None: Use this to deselect All the selected members
- Summary: It will display the information regarding the set. This includes Field name, Condition we used and the number of records we selected from the Total number of records etc
Tableau Set General Tab
Within the General tab of a tableau sets, we have three more options:
- Select from List: This option allows you to choose the required members from the available list.
- Custom Value List: This option allows you to write Custom members.
- Use all: This option allows you to select All the available members from the list
Custom Value List option in Tableau Set
We just added three random records here. In real-time, you have to write the existing values only.
Click OK to finish creating our Tableau Set.
How to Edit Tableau Set
To edit the existing sets in Tableau, Please click on the Dropdown arrow in the upper right corner of the Set name and select the Edit Set… option from the context menu as shown below
Once you choose the Edit Set… option, a new window will be opened to edit the existing set.
Use All section option in Tableau Set
Once you select this option, there is nothing you can do because this option will select All the available members from the list
Click OK to finish editing the existing Set. Please Drag the newly created set (Example Set) from Sets region to Row Shelf and place it before the State filed as shown below.
How to Delete Tableau Set
To delete the existing set in Tableau, Please click on the Dropdown arrow in the upper right corner of the Set name and select the Delete option from the context menu as shown below
Tableau Set Select From List
In this example, we will create one more set to choose the random 6 States from the available state members in tableau. To do this, please navigate to the General tab and select the Select from List radio button and select required state members from the available list.
Please Drag the newly created set (Random 6 States) from Sets region to Row Shelf and place it before the State field as shown below.
From the above listing, you can observe that California, Delaware, District of Columbia, Georgia, Idaho, and Indiana are listed in IN section because these are the states we selected when we created our Set.
Tableau Set Condition Tab
In this example, we will create one more set to find the States generating Positive Profits. To do this, navigate to the Condition tab and select the By Field radio button, and then select SUM of Profit greater than or equal to 0.
Click OK to finish creating a new Set in Tableau. Let us replace the Random 6 States set with our newly created set, called States with Positive Profits, and see the result.
From the above listing, you can see all the states with positive profits placed in IN filed, and Negative profits placed in Out Filed
Tableau Set Top 10 Tab
In this example, we will create one more set to find the Top 10 States generating the highest Profits. To do this, Please navigate to Top tab and select the By Field radio button and add constant value 10 as shown below.
TIP: If you want to make this dynamic, replace the value 10 with Parameter name. Please refer Tableau Parameters article for understanding the creation and use of parameters
Click OK to finish creating a new Set in Tableau. Let us replace the States with Positive Profits set with our newly created set, called Top 10 States by profits and see the result.
From the above listing, you can observe that California, Delaware, Georgia, Indiana, Kentucky, Michigan, Minnesota, New York, Virginia, and Washington are in the Top 10 list according to their profits.
TIP: Please refer Combined Tableau Sets article to understand the creation of Combined Sets in Tableau