Clustering in
Tableau
Learn how clustering algorithms automatically group data points into meaningful segments, and how to interpret those segments to unlock insights in your visualizations.
What Is Clustering?
Clustering is an unsupervised machine learning technique that groups data points so that points within a group are more similar to each other than to those in other groups. Unlike classification, there are no predefined labels: the algorithm discovers the structure on its own.
Why Clustering Matters
Visualizing Clusters in a Scatter Plot
The K-Means Algorithm
Tableau uses k-means clustering under the hood. The algorithm minimizes the total within-cluster distance: the sum of squared distances from each point to its cluster's centroid.
K-Means: Iteration by Iteration
Clustering vs. Classification
| Clustering | Classification | |
|---|---|---|
| Learning Type | Unsupervised | Supervised |
| Labels | No predefined labels | Requires labeled training data |
| Goal | Discover groups | Predict known categories |
| Output | Cluster assignments (1, 2, 3 ...) | Predicted class (e.g., "Spam") |
| Tableau Feature | Analytics pane: Cluster | Not built-in (use TabPy) |
How to Apply Clustering in Tableau
Choosing the Number of Clusters (\( k \))
Tableau can auto-select \( k \), but understanding how it decides helps you override wisely. A common heuristic is the elbow method: plot the within-cluster variance against \( k \), and look for the "elbow" where adding more clusters gives diminishing returns.
Example 1: Customer Segmentation
A retail company plots Average Order Value (x-axis) vs. Number of Orders per Year (y-axis) for 500 customers. After clustering with \( k = 3 \):
Example 2: Sales and Profit Analysis
Reading Tableau's Cluster Summary
When you right-click a cluster in Tableau and select "Describe Clusters", you get a summary table. Here is how to interpret the key metrics:
| Metric | Cluster 1 | Cluster 2 | Cluster 3 |
|---|---|---|---|
| Count | 210 | 180 | 110 |
| Avg Sales | $45 | $320 | $780 |
| Avg Profit | -$12 | $85 | $210 |
Using Clusters as a Dimension
Once Tableau assigns clusters, the result appears as a new dimension on the Marks card. You can then:
What Inputs Does Tableau Use?
Tableau clusters on the measures currently in the view. This means the variables on your Rows, Columns, and Marks card determine the clusters.
Common Mistakes
Clustering Summary
| Concept | Details |
|---|---|
| Algorithm | K-means (unsupervised) |
| Input | Continuous measures in the view |
| Choosing \( k \) | Auto or manual; use elbow method |
| Output | Cluster dimension (1, 2, 3 ...) |
| Key Metric | Within-cluster variance (lower = tighter) |
| Interpretation | Name clusters by meaning, not number |
| Limitation | Sensitive to outliers and measure selection |
Question 1 of 5
Clustering in Tableau is an example of which type of learning?
Question 2 of 5
In the k-means algorithm, what does the "centroid" represent?
Question 3 of 5
A scatter plot shows three distinct groups of customers. You apply clustering and Tableau assigns \( k = 3 \). One cluster has high average order value and low frequency. What is the best label for this segment?
Question 4 of 5
Why does Tableau standardize measures before running k-means?
Question 5 of 5
In the elbow method for choosing \( k \), you should select the value of \( k \) where: