Tableau 10 brought the new clustering feature, and this is one of my favorite new features of Tableau. One thing that you might not realize is that you can reuse the clustering model within your dashboard after you create it. Tableau allows you to save a cluster as a group.
Tableau 10 also allows groups to be used in calculated fields, so that means we can create a parameter to switch groups and apply color. Using this technique, we can give our users the ability to change how many clusters are being applied to the data. This lets them explore the data on their own without depending on someone to manually change the cluster size. In this example, we are looking at NFL Combine statistics for Wide Receivers.
First, let's create a scatterplot and see how it's done.
1. Click the analytics tab and drag the Cluster into your view
2. In this case, I wanted to let the user switch between 3-5 clusters. You can create as many clusters as you'd like, but we will set the first to cluster to 3. In this example, we are clustering by 40 yard dash time and weight. This will allow us to see players who are big and fast, small and fast, big and slow, etc.
3. Once you have created the cluster, drag it back to the dimensions to create a group.
4. Name the newly-created group so you can identify how many clusters were used.
5. Now, click Edit clusters and change the number of clusters to 4. Do this for as many clusters as you'd like to create.
6. Once again, drag the newly created cluster to the dimensions and name it appropriately.
7. Create a parameter with the list of clusters and the value
8. Create a calculated field to check the parameter value and switch clusters appropriately.
9. Drag the new calculated field to the color mark.
10. Finally, we can enhanced the graph a bit by adding some dashboard actions to highlight the cluster and show the player names on hover. For more details on this technique, see this post.
Feel free to download the workbook and comment with questions.