How to create drill-down Set Actions

by Débora Contente

Last week I wrote a blog post on how to add icons to your drill-down set actions assuming you’d know how to do it. But what if you don’t? Well, you can just continue reading.

What are Set Actions?

Set actions are one of the ways that Tableau created to allow users to interact with dashboards/worksheets. Basically, set actions take an existing set and update its values based on a user’s action in the viz (hence the name – set action). If you would like to read more on it I would definitely recommend Harry’s blog post.

How do you use Set Actions to create an intuitive drill-down?

As usually, I will be using the Superstore dataset for this example.

In this case, the aim is to create a drill-down from Category to Sub-Category.

1 – Create a Set based on the first field you want to drill-down onto

For that, you just need to right-click the field you’re interested in > Create > Set (screenshot below). In this case, our first set should be based on Category – that is the first field we want to drill down onto.

How to create a Set based on a field.

In terms of how to configure the Set, you don’t need to worry about it – you just need to name it appropriately and click OK. I tend to name my sets to be used in Set Actions as “Selected X ” so my set will be “Selected Category“.

2 – Create a calculated field that will get the items you would want to drill-down onto based on the selection

The next step is to create a calculated field that, if a Category is selected, will bring the related subcategories. This is the coding bit you will need for that:

IF [Selected Category]
THEN [Sub-Category]

I will call this “Sub-Categories from Selected Category“.

3 – Add a worksheet action

You could jump to step 4, but I prefer to test everything along the way rather than doing everything and testing it in the end. So that is what we are doing now – making sure our logic is correct.

First, add the important fields (Selected Category, Category, Sub-Categories from Selected Category) to the view:

Add the relevant fields to the view before setting up the action

After that, click on Worksheet > Actions (or use the shortcut Ctrl+Shift+A if you are using Windows). A window will pop-up where you can choose to Add Action > Change Set Values.

Add Set Action to Worksheet

In terms of configuring the Action itself, following is where you want to touch:

How to configure your Set Action

1 – Do not ever forget to name anything!

2 – Here you will define what type of action you want – on select, on hover or on menu.

3 – The set you want to be affected by the selection/hover/menu.

4 – What the selection will result in. To be fair, in most of the cases I use “Remove all values from set”.

4 – Create a copy of your drill-downable field (Category in this case) and add it to the view in first place

This is what you need to do so that your action works for individual Categories and not all at once. If you do not add this, if you click on a category, all will expand. See the difference below:

Then you just need to right click in your duplicated field and deselect Show Header so that it does not appear twice!

5 – Add your icons to spice it up

And there you go! I would highly recommend you to add icons to make it even more user-friendly. You can read my blog post on how to do it here.

6 – Extra quick tip

Once you start creating lots and lots of Set Actions, your Data pane can start to be really messy (I’ve been through it, trust me!)… A good way to go around it is to create folders for each action! That way everything gets more cleaned and organised.

I hope this has been helpful. Let me know if there are any topics you would like me to write about!