01 / 20

Sorting, Grouping
& Sets

Master the three foundational techniques for organizing data in Tableau: sorting to reveal order, grouping to simplify categories, and sets to isolate subsets for powerful comparisons.

Tableau

What is Sorting in Tableau?

Sorting arranges the rows or marks in your visualization by a field's values: alphabetically, numerically, or by a custom order. It is the simplest way to turn a chaotic bar chart into a meaningful story.

Unsorted C A D B → Sorted (Desc) D C B A Sorting reorders bars by their measure value Ascending, Descending, or Manual

What is Grouping in Tableau?

Grouping combines related dimension members into a single, higher-level category. It simplifies your view by merging many values into fewer buckets: think of it as creating folders for your data.

Original New York New Jersey Connecticut California Oregon Grouped East Coast NY, NJ, CT West Coast CA, OR

What are Sets in Tableau?

A set defines a custom subset of your data based on conditions or manual selection. Unlike groups, sets produce a binary split: every row is either IN the set or OUT of the set. This makes them ideal for comparisons.

ALL DATA IN Set OUT of Set Members meeting condition Remaining members

Why Sorting, Grouping & Sets Matter

★ Sorting
Reveals rank and order: instantly see your top sellers, worst performers, or trends.
★ Grouping
Reduces complexity: collapse 50 states into 5 regions without changing your data source.
★ Sets
Enables dynamic comparisons: compare "Top 10 customers" vs. everyone else with a single control.

The Sorting Mechanism

Tableau evaluates sorts in a priority stack: the sort applied last takes precedence. Each sort operates on a dimension field and orders it by a chosen measure or alphabetical rule.

Priority 1 (Wins) Last applied sort Priority 2 Earlier applied sort Priority 3 Default data source order ↑ Higher Priority Sort Types: Alphabetical, Field (Measure), Manual, Nested

Groups vs. Sets: Core Distinction

Groups Sets
Purpose Combine members into categories Define IN/OUT subsets for comparison
Output New grouped dimension (multi-value) Binary: IN or OUT
Dynamic? ✕ Static: manual assignment ✓ Can be dynamic via conditions
Use on Filters? Yes, as dimension filter Yes, and also Show IN/OUT on Color
Combine? Cannot combine groups Combined sets (union, intersect, diff)
Created from Right-click dimension → Group Right-click dimension → Create Set

How to Create a Group

1
Select members in the view (click, then Ctrl/Cmd-click to multi-select marks or labels).
2
Right-click → Group (or click the paperclip icon in the tooltip). Tableau creates a new field with a paperclip icon.
3
Rename the group by editing the alias. Ungrouped members appear under "Other".
4
Drag the new field onto Rows, Columns, or Color to use the grouped dimension in your viz.

How to Create a Set

1
Right-click a dimension in the Data pane → Create → Set.
2
Choose a method: pick specific members on the General tab, or define a rule on the Condition or Top tab for dynamic behavior.
3
Name the set descriptively (e.g., "Top 10 Customers by Sales").
4
Drag to Color or Filters. Every mark splits into IN and OUT categories.

Example 1: Sorting a Bar Chart

Scenario: You have a horizontal bar chart of Sales by Sub-Category. The bars are in default data-source order: hard to read. Sort descending by \( \text{SUM(Sales)} \) to reveal the top performers.

Phones Chairs Storage Tables Binders Accessories Paper $330K $280K $224K $180K $140K $96K $60K
↓ Sorted by \( \text{SUM(Sales)} \) descending

Example 2: Grouping States into Regions

Scenario: Your dataset has 50 U.S. states. You want to compare 4 custom regions: Northeast, Southeast, Midwest, and West. Group the State dimension to create these categories.

Before: 50 States ... 50 thin bars → After: 4 Groups NE SE MW West Steps: 1. Right-click State → Create → Group 2. Select states, click "Group" 3. Rename each group (NE, SE, MW, West) 4. Replace State with State (group) on Rows

Example 3: Dynamic Set for Top Customers

Scenario: Create a set for Top 10 Customers by Sales. Then compare their profit margin against all other customers using the IN/OUT split on Color.

IN Set (Top 10) 22% Margin OUT of Set 11% Margin vs. Top 10 customers: 2x profit margin Set auto-updates when data refreshes

Combining Sets for Advanced Analysis

Tableau lets you combine two sets with set operations: just like mathematical set theory. This unlocks complex multi-condition analysis.

★ Union (OR)
Members in either Set A or Set B (or both).
★ Intersect (AND)
Members in both Set A and Set B simultaneously.
★ Difference (NOT)
Members in Set A but not in Set B (or vice versa).
Union Intersect Difference

Step-by-Step: Applying All Three

1
Build your base view: drag a dimension to Rows and a measure to Columns to create a bar chart.
2
Sort: click the axis header (descending → ascending → data order) to rank the bars.
3
Group (if needed): select related marks → right-click → Group to simplify the view into fewer categories.
4
Create a Set (for comparison): right-click the dimension → Create Set → define condition or top N. Drag to Color.
5
Refine: use "Show Set" on a dashboard to let users toggle set membership interactively.

Common Mistakes to Avoid

✕ Sorting After Filtering
Applying a sort, then adding a filter can break the sort order. Always re-sort after filtering.
✕ Groups on Live Data Changes
New dimension members won't auto-join a group: they fall into "Other". Periodically review groups when data updates.
✕ Confusing Sets with Filters
A filter hides data; a set keeps all data visible but marks it IN/OUT. Use sets when you want to compare, not remove.

Summary Comparison

Sorting Grouping Sets
What it does Reorders marks Merges members Splits IN/OUT
Changes data? No Creates new field Creates new field
Dynamic? Yes (auto-updates) Static (manual) Can be dynamic
Best for Ranking, top/bottom Simplifying categories Subset comparisons
Can combine? N/A No Yes (union, intersect)
On Color shelf? No Yes (as dimension) Yes (IN/OUT)

Question 1 of 5

You have a bar chart of Sales by Product Name. You want the highest-selling product at the top. What should you do?

Question 2 of 5

You want to combine "Desks," "Bookcases," and "Chairs" into a single category called "Furniture". Which feature should you use?

Question 3 of 5

What is the key difference between a group and a set in Tableau?

Question 4 of 5

You create Set A (Top 10 by Sales) and Set B (Top 10 by Profit). You want customers who appear in both sets. Which combined set operation do you use?

Question 5 of 5

You applied a descending sort to "City" by \( \text{SUM(Sales)} \), but after adding a filter on "Region," the sort order looks wrong. What is the most likely cause?