For a recent client project, I was tasked with creating a view that explores the range of services their clients subscribe to. Ideally, the dashboard would demonstrate a breakdown of services requested by each client, and identify any outliers or clusters of clients with similar demands. This turned out to be an interesting use case for set actions in Tableau.
So for this blog, I have recreated a similar visualisation using sample Superstore. I want to analyse the sum of sales per subcategory, as well as a breakdown of sales in each state. For example, I can see that a large portion of sales in Michigan are for binders, while in Florida over a quarter of sales goes into machines. I’ve also included tips on some extra steps I took to improve the overall functionality of the dashboard.
Click here to interact with the full viz
1. Create a chart showing the breakdown of sales per state
First, we want to create a simple bar chart showing sales per subcategory. We also want to see a breakdown of the percentage of sales that each state spends in each subcategory. Drag in both SUM(Sales) and the percent of total SUM(Sales), and change the mark type accordingly. Ensure state is on detail and that the table calculation is configured to compute % of sales per state. To simplify the view, I have filtered to just the top 10 states by sales.
2. Create a set action
Create a set using states, drag this onto colour for both charts and add a set action. Selecting a state will then highlight all the state circles and proportionally brush the sum of sales in each subcategory.
We are almost there! But here are some extra ideas to improve the usability and clarity of the dashboard…
3. Include a highlight action
Since we are comparing the breakdown of each state’s purchases across all subcategories, it would be helpful to see each dot more clearly. This is simply a matter of adding a highlight action so that selecting any one member highlights the rest of the state’s dots.
4. Show a label only when set members are selected
I wanted to label the bar chart with the sum of sales, but only when a state is selected. This involved a couple of quick calculations:
i. Count the number of records in a set.
ii. If I were interested in getting an exact number of states selected, a fixed calculation such as the following could be used since there are numerous records per state. However in this case, this step could have been skipped.
iii. Create a calculation that only shows the sum of sales when the set is populated with at least one state. Drag this calculation onto the label shelf for the bar chart.
And that’s it! Although the concept of the chart is quite simple, it was a new approach for me to visualise a breakdown and comparison of sales by a given dimension. It brought together different techniques we had been learning here at the Data School and was overall a lot of fun to put together!