top of page

Tableau Sets in Action


Actions add context and interactivity to your data presentations. User actions like selecting a value for a mark, hovering over selecting a particular data element, pressing a menu button can be acted upon, to make changes to the user view accordingly. We can achieve each of these by creating actions in various ways.

Tableau provides with different kinds of options for Actions. In this article, we are going to use the "Actions" with the "Sets" .


By the end of this article, you would be able to understand how basic Set Actions can be implemented in tableau


The example used in this article uses Tableau Parameters and Sets. You will need to have a basic knowledge of what these are and how you use them. Also, we will be using the Sample Super Store data.

Sets in Action

Before we can go ahead and discuss about set actions, we need to understand why? For this let us create a viz with Sales by Category and Sub Category. Create a parameter for category. Setup a Parameter Action (refer to my article "Tableau Parameters in Action") at the dashboard level, using which, based on the user's selection of category from the viz, the sub-category level sales are drilled down for the specific category. This is what the viz looks like at this point, on the dashboard.

There are 2 problems with this kind of functionality.

First: Atleast one Category is drilled down at any time

Second: We cannot select more than one category at any given time.

Both of these problems can be overcome using Set Actions. Now that we know "why" part of it, lets explore the "how" .

Let us first create a set against the dimension Category as shown in below screen shot

Next, we need to define an action using this set. For this go to Top Menu Worksheet --> Actions --> Add Action --> Change Set Values. In the create window that comes up, we will need to setup the Action as intended.

Step 1: Name the new action uniquely

Step 2: Source Sheet is the sheet/dashboard to which this action needs to be applied . For now select the sheet we are currently in.

Step 3: Target Set is the set to which the user selected values need to be assigned to (the set we created above)

Step 4: Running the Action will assign/add/remove values from the set. Here we will choose Assign

Step 5: Clearing the Selection will keep the current selection/Add all the applicable values to the set(Catgegory in our case) or Remove all values from the set. Let us choose "Add all values to the set" for now

Now that we are done with setting up the action, we need to write the underlying code, where the user selection is taken into consideration for displaying the sales. For this we need to create a calculated field just like we did for parameter, except that instead of checking the parameter value, we need to check the set value. This is how I defined my calculated field.

We are now all set to use this new set in action. We can do that by simply dropping the calculated field in place of the actual sub category

After that you will see that the viz changes to something like this. In this view the sub-categories for all the categories are expanded because we chose the "All" option in step 5 above. But if we want the default view to show only the category level sales, then we can do that by editing the action. For that go to worksheet --> Actions --> Select the current action in context --> edit. In the edit window choose the "Remove all values from Set" option and save your changes. Now when we come back to the viz and click somewhere outside of the viz, we can see it moving up to the category level for all categories. Now our action is completely in place.

Just play around with the various options in the create/edit action window, to see how they change your viz.

Now we need to do one last thing before we can make this viz interactive for the user on the dashboard. Currently, the new action we defined works only within this worksheet. When we add this viz to the dashboard, it does not work. For, that in the edit action window, choose the dashboard in which you have dropped this viz in, as seen in the below screenshot.

We are now all set to provide the user with the drill down functionality for the category and sub-category using Set Actions.

Excercises for Practice

1. Create a Region/State level drilldown dashboard using Set Actions.

2. Create a Map viz, to show the sales by State, colour by the amount/percent of total. Create a Set Action, where when the user selects a set of states using the "Lasso Selection" option, only sales for user selected states are displayed and colours change accordingly

40 views0 comments


Rated 0 out of 5 stars.
No ratings yet

Add a rating
bottom of page