Master Tableau From Scratch

Learn Tableau fundamentals, data connections, data preparation, filtering, data modeling, calculations, LOD expressions, visualizations, dashboards, and storytelling through structured practical lessons.

COURSE SYLLABUS

Creating Sets in Tableau

Learn how to create and manage Sets in Tableau to identify specific subsets of dimension members, compare selected data with the remaining records, and perform advanced analytical operations using Fixed Sets, Dynamic Sets, Conditions, and Top N selections.

1. Introduction to Sets in Tableau

A Set in Tableau is a custom subset of members from a dimension. It allows users to select specific members of a dimension and separate them from the remaining members for analytical purposes.

Sets are useful when you want to analyze a selected group of customers, products, regions, categories, or other dimension values. Tableau identifies records that belong to the selected set as IN and records that do not belong to the set as OUT.

Example: Customer Sales Analysis

Suppose a company has 1,000 customers. You want to identify the top 10 customers based on total sales and compare their performance with all other customers.

You can create a Set containing the top 10 customers. Tableau classifies those customers as IN and the remaining customers as OUT.

Tableau Set Concept IN Selected Members Customer A Customer B OUT Remaining Members Customer C Customer D A Set divides dimension members into two groups
Figure: IN and OUT classification in a Tableau Set.

2. Why Do We Use Sets?

Sets help analysts focus on selected members of a dimension without permanently removing the remaining members from the analysis. They make it easier to compare selected records against the rest of the dataset.

Common Use Cases

  • Identify the top 10 customers based on sales.
  • Compare profitable products with less profitable products.
  • Analyze selected regions against all other regions.
  • Identify customers who meet specific business conditions.
  • Compare high-performing and low-performing product categories.
  • Build interactive dashboards using set membership.

3. Types of Sets in Tableau

Tableau supports two main approaches to creating Sets: Fixed Sets and Dynamic Sets. The main difference is how the members of the Set are selected and updated.

3.1 Fixed Sets

A Fixed Set contains manually selected dimension members. Its membership remains based on the selected values until the Set is edited or updated manually.

Example:

You manually select Mumbai, Pune, and Nashik from the State dimension. Tableau creates a Set containing these three selected states.

  • Members are selected manually.
  • Membership does not automatically change according to a Top N ranking.
  • You can edit the Set to add or remove members.
  • Useful when you need a predefined group of dimension members.

3.2 Dynamic Sets

A Dynamic Set determines its members using a condition or Top N rule. Tableau evaluates the rule against the available data to determine which members belong to the Set.

Example:

Create a Set containing the top 10 customers based on total sales. When the underlying data changes and the Set is recalculated, the membership can change according to the updated ranking.

  • Membership is determined by defined rules.
  • Supports condition-based selection.
  • Supports Top N selection.
  • Useful for regularly changing business data.
Fixed Set Manual Selection A, B, C, D Remains until edited Dynamic Set Rule-Based Selection Top 10 Customers Re-evaluated using rule Two approaches to Set membership
Figure: Fixed Set and Dynamic Set comparison.

4. How to Create a Set in Tableau

Tableau provides multiple ways to create a Set. You can select members directly from the Data Pane or create a Set from selected marks in a visualization.

Method 1: Create a Set from the Data Pane

  1. Open Tableau Desktop and connect to your dataset.
  2. Locate a dimension in the Data Pane, such as Customer Name.
  3. Right-click the dimension.
  4. Select Create and then Set.
  5. Enter a meaningful name for the Set.
  6. Select the required members in the General tab.
  7. Click OK to create the Set.

Example

Suppose your dataset contains a Customer Name dimension. You want to create a Set named Premium Customers.

Select the customers that you want to include in the Set and save it. The new Set appears in the Sets area of the Data Pane.

Method 2: Create a Set from Selected Marks

  1. Create a chart using a dimension such as Customer Name.
  2. Select one or more marks directly in the visualization.
  3. Right-click the selected marks.
  4. Choose Create Set.
  5. Enter the Set name.
  6. Click OK.

Tableau creates a Set using the selected dimension members. This approach is useful when you visually identify the members that you want to analyze.

5. General Tab in Set Creation

The General tab allows you to select which dimension members should be included in a Set. It is especially useful when creating a manually selected Fixed Set.

General Tab Options

  • All: Displays all available dimension members.
  • Selected: Displays the members selected for inclusion.
  • Search: Helps locate a particular dimension member.
  • Select All: Selects all available members.
  • Clear: Removes the current selection.
Tip: Use the Search option when your dimension contains hundreds or thousands of members. It helps you quickly find the required values.

6. Condition Tab in Dynamic Sets

The Condition tab allows you to define rules for selecting dimension members. Tableau evaluates the defined condition and includes the members that satisfy the condition.

Types of Conditions

6.1 By Formula

The By Formula option allows you to define a logical expression that determines which dimension members should be included.

Example:

SUM([Sales]) > 50000

This condition selects dimension members whose aggregated Sales value is greater than 50,000, subject to the level and context of the Set calculation.

6.2 By Field

The By Field option allows you to define a condition using an aggregation and a selected measure.

Example:

  • Field: Sales
  • Aggregation: Sum
  • Operator: Greater than
  • Value: 50,000

Tableau evaluates the selected measure for each dimension member and includes the members that satisfy the specified condition.

Condition: SUM(Sales) > 50,000 Condition TRUE Included in Set Condition FALSE Excluded from Set
Figure: Condition-based Set membership.

7. Top Tab in Dynamic Sets

The Top tab is used to select a specified number of dimension members based on a measure. It is commonly used to identify top-performing or lowest-performing customers, products, and regions.

Top N Selection

Suppose you want to find the top 10 customers based on total sales. You can configure the Top tab as follows:

  • Choose Top.
  • Select By Field.
  • Enter 10 as the number of members.
  • Select Top.
  • Select Sales as the measure.
  • Select Sum as the aggregation.
  • Click OK.

Tableau evaluates the sales value for each customer and selects the top 10 customers according to the configured ranking rule.

Top and Bottom Selection

Option Purpose Example
Top 5 Selects the highest-ranked five members. Top 5 products by sales.
Bottom 5 Selects the lowest-ranked five members. Bottom 5 customers by profit.
Top 10 Selects the highest-ranked ten members. Top 10 regions by revenue.
Important: If multiple members have the same value at the ranking boundary, Tableau's Top N behavior can include tied members. Therefore, the resulting Set may contain more members than the requested N in some cases.

8. Understanding IN and OUT

After creating a Set, Tableau provides two membership categories: IN and OUT. These categories help you distinguish selected dimension members from all other members.

IN

IN represents dimension members that belong to the Set. For example, if a Set contains the top 10 customers by sales, those selected customers are classified as IN.

OUT

OUT represents dimension members that do not belong to the Set. These are the remaining customers who are not included in the selected Set.

How to Use IN/OUT

  1. Locate the created Set in the Data Pane.
  2. Drag the Set onto Color in the Marks Card.
  3. Tableau separates the visualization into IN and OUT.
  4. Use labels, colors, or filters to compare the two groups.
Customer Sales by Set Membership IN 80% OUT 40% Illustrative values for demonstrating IN and OUT
Figure: Example comparison of Set membership groups.

9. Using Sets in Worksheets

Once a Set is created, you can use it in different parts of a Tableau worksheet. The Set can be used to organize the view and compare selected members with the remaining data.

Location Usage Example
Rows Display Set membership as a row field. Show IN and OUT customer groups.
Columns Separate data based on membership. Compare sales by Set category.
Color Apply different colors to Set members. Highlight top customers.
Filters Restrict the view to selected members or their complement. Display only IN customers.
Detail Add Set membership information to the level of detail. Support detailed analysis.
Tip: Dragging a Set to Color is a simple way to visually compare members that belong to the Set with those that do not.

10. Combined Sets in Tableau

Tableau allows you to combine two existing Sets created from the same dimension. This helps you perform comparisons between different groups of members.

Combined Sets can be useful when you want to find members that belong to both Sets, members that belong to either Set, or members that belong to one Set but not the other.

Common Set Combination Operations

Operation Meaning Example
All Members in Both Sets Includes members that belong to either Set. Customers in Set A or Set B.
Shared Members Includes members common to both Sets. Customers in Set A and Set B.
Members in A but not B Includes members in the first Set but not the second. Customers in Set A excluding Set B.
Members in B but not A Includes members in the second Set but not the first. Customers in Set B excluding Set A.
Combined Sets - Conceptual Venn Diagram A B A ∩ B The overlapping area represents shared members
Figure: Conceptual intersection of two Sets.

Steps to Create a Combined Set

  1. Create the first Set from a dimension.
  2. Create a second Set from the same dimension.
  3. Locate either Set in the Data Pane.
  4. Right-click the Set and select Create Combined Set.
  5. Provide a name for the combined Set.
  6. Select the required combination operation.
  7. Click OK.

11. Practical Example: Top 10 Customers by Sales

Let's understand how Sets work using a practical business scenario. A sales manager wants to identify the top 10 customers based on total sales and compare them with other customers.

Step 1: Connect to the Dataset

Open Tableau and connect to a sales dataset containing Customer Name, Sales, Profit, and Order Date fields.

Step 2: Create a Customer Sales View

  1. Drag Customer Name to Rows.
  2. Drag Sales to Columns.
  3. Ensure Sales uses the SUM aggregation.
  4. Sort the customers in descending order of sales.

Step 3: Create a Top 10 Set

  1. Right-click Customer Name in the Data Pane.
  2. Select Create and then Set.
  3. Open the Top tab.
  4. Select By Field.
  5. Choose Top 10 by SUM(Sales).
  6. Name the Set Top 10 Customers.
  7. Click OK.

Step 4: Compare IN and OUT

  1. Drag Top 10 Customers onto Color in the Marks Card.
  2. Tableau displays IN and OUT categories.
  3. Use labels to display sales values.
  4. Compare the top customers with the remaining customers.

Expected Analysis

Customer Group Membership Analysis
Top 10 Customers IN Customers with the highest sales ranking.
Other Customers OUT All remaining customers outside the Top 10 Set.

12. Difference Between Groups, Sets, and Filters

Groups, Sets, and Filters are important Tableau features, but they serve different purposes. Understanding their differences helps you select the correct feature for your analysis.

Feature Groups Sets Filters
Purpose Combine dimension members into categories. Create a subset of dimension members. Restrict the data displayed in a view.
Membership Based on manually grouped values or defined grouping. Based on selected members or rules. Based on filter conditions or selections.
IN/OUT No standard IN/OUT classification. Supports IN and OUT. Does not use Set membership labels.
Top N Not a standard Group feature. Supports Top N membership. Can filter Top N using dimension filter options.
Typical Example Combine product categories. Top 10 customers. Display orders from a selected year.
Remember: Groups combine values, Sets identify subsets of dimension members, and Filters control which data is included in the worksheet view.

13. Editing and Managing Sets

After creating a Set, you can edit its membership or configuration whenever your analysis requirements change.

How to Edit a Set

  1. Locate the Set in the Data Pane.
  2. Right-click the Set name.
  3. Select Edit Set.
  4. Update the General, Condition, or Top settings as required.
  5. Click OK to save the changes.

Adding and Removing Members

For manually selected Sets, you can add or remove members by editing the General tab. For rule-based Sets, update the condition or ranking configuration to change which members qualify.

Rename or Delete a Set

Right-click the Set in the Data Pane and choose Rename to change its name. Select Delete when the Set is no longer required.

14. Common Mistakes When Creating Sets

Problem Possible Reason Solution
Incorrect members in Set Wrong dimension members were selected. Review the General tab or selection.
Unexpected Top N results Wrong measure or aggregation selected. Verify the Top tab configuration.
Set does not update as expected Set uses manual membership instead of a rule. Review whether a Dynamic Set is required.
IN and OUT not visible Set is not included in the worksheet view. Drag the Set to Color, Rows, or Columns.
Unexpected condition results Incorrect field, aggregation, or formula. Check the condition and measure configuration.

15. Best Practices for Using Sets

  • Use meaningful names such as Top 10 Customers or High Profit Products.
  • Choose Fixed Sets for manually maintained selections.
  • Choose Dynamic Sets when membership should follow a condition or ranking rule.
  • Verify the measure and aggregation before configuring Top N.
  • Use IN and OUT to compare selected members with remaining members.
  • Keep Set conditions simple and easy to understand.
  • Use Combined Sets when comparing two related subsets.
  • Validate Set membership after refreshing or changing the data source.

Summary

Tableau Sets are used to create subsets of dimension members for focused data analysis. Fixed Sets contain manually selected members, while Dynamic Sets use conditions or Top N rules to determine membership. The IN and OUT categories help compare selected members with the remaining data. Sets can be used on Rows, Columns, Color, Filters, and Detail in a worksheet. Tableau also supports Combined Sets for comparing two subsets through union, intersection, and difference operations. By understanding how to create, configure, edit, and use Sets, analysts can perform more flexible and meaningful business analysis.