In Tableau, sets are a great way to create a segment of a dimension’s data.

For instance, suppose we have sales data with a dimension for the product categories and subcategories. A recent survey of our store reveals which products are particularly popular with children. We could look at the individual Product Ids and add all of those products into a set – ‘Popular with children’.

We can then use that set as a filter or dimension on other charts to analyse them.

Here, I’ll use sets on a sales dashboard to allow us to ‘zoom in’ on specific products and that look interesting, making the chart more interactive.

Look at the dashboard below. The top left chart shows products by total sales and profit ratio. I’d like to analyse a dynamically selected subset of products and have the other charts update to only that set of products. We could use multiple filters to achieve this, but it’s quite tedious. Instead, we’ll use sets.

Step 1 – Creating the Sets

To begin, let’s create our sets. I mentioned that I wanted to zoom in on products and cities.

I’ll right-click on Product Name, select Create, then select Set. A dialog box will open up asking me which products I want in the set. Because I want the user to select the products they’re interested in at runtime, I’ll simply select All products to put in the set.

Next, I’ll do the same with city, calling the new set ‘City Set’.

Step 2 – Creating the Dashboard Charts

For my dashboard, I’ll create 3 different charts. A scatter chart, a map, and a bar chart.

For the scatter chart, I want to view the sales figures and average profit ratio (Profit / Sales) of every product in my product set. I’ll then put the profit ratio onto Colours to clearly see which products are performing poorly.

Next, let’s create a map showing every city and using colour to indicate profit ratio so we can easily see trouble areas.

Remember the Product Name Set I created? I then drag this into Filters. This means that the map will automatically update when I select a subset of products from the set.

Finally, let’s create a bar chart showing the average profit ratio of each sub-category.

Like the map chart, I’ve added Product Name Set to Filters. I’ve also added City Set. This means that whenever I select a subset of products OR cities (on the map), this bar chart will update to reflect only that data.

Step 3 – Set Actions

Ok, so I’ve created my charts and my custom sets. I’ve also added all my charts to a dashboard like the one at the start of this blog. What’s missing is the action that tells my dashboard to update my sets based on whatever I select on the respective charts.

In Dashboard -> Actions I select Add Action and select Change Set Values.

I then create a set action for selecting my individual products in the scatter chart.

Note the options I’ve selected at the bottom. Whenever I select products from the chart it will create a new set with only those products. When I click on the blank area of the chart, it will clear my selection and default to all products.

Next, I’ll do the same thing for selecting cities, and apply it to the Map sheet.

And that’s it! Now, I can drag select an area on my scatter chart (updating my Product Name Set), which will update my map and bar chart. I can also select an area on my map to select cities (updating my City Set) to further narrow down the selection, which also updates my bar chart.

Essentially, I’ve said “I’m interested in these products in the scatter chart, show me which cities they’re sold in. Now, I’m interested in these specific cities where the products are sold, show me the profit ratio breakdown by sub-category.”

With action sets, you can make dashboard engaging and a great way to perform data investigation. Try using action sets instead of filters and see what kind of interactions you can make!

 

The Data School
Author: The Data School