top of page
  • Writer's pictureJames Goodall

Tableau Bitesize: Set Actions

For the first Tableau Bitesize I'm publishing on here, I've decided to look at Set Actions. These were introduced in version 2018.3 of Tableau, and while they are fairly similar to Parameter Actions, there are a few key differences.

Parameter Actions allow us to dynamically change the value of a parameter visually which then allows us to use this constant value in a multitude of different scenarios (calculations, table calculations, reference lines etc etc) whereas Set Action allow us to dynamically add specific values to a set which could then be used to dictate certain functionality (such as setting colours, or filtering data at the same time).

The image below gives you a visual representation of how Set Actions can work

What we're going to build over the course of this blog is a bar chart that shows populations within Surrey Local Authority Districts, that when clicked on, will add that value to a set, allowing you to convert that dimension value into a stacked bar chart which will show you the breakdown by age band, as shown in the image below

To start, connect to the ‘SURREY_LSOA_POPULATION_BANDS' .csv file attached below

Download CSV • 2KB

Drag the ‘Area Names’ dimension to the ‘Columns’ shelf and the ‘Value’ measure to the ‘Rows’ shelf

Next, right click on the ‘Area Names’ dimension and select ‘Create -> Set’

Call the set ‘Area Names Set’, leave all the selections blank and click ‘OK’

Next, create a calculated field called ‘Set Action Selector’ and enter the following formula:

What this is doing is saying that when we click on a selection (and make it ‘TRUE’), then we want the result to be the related ‘Age Band’ values, otherwise leave it as is.

Drag the ‘Set Action Selector’ calculated field onto the ‘Colour’ mark

Now this has added different colours for all of the area names, but for our purposes, we want these all to be the same colour and for our separate colour palette to be for the age bands.

Change the colours of all the area names to be the same

Now, if we want to add some colour for the age bands, we’ll need to get them displayed. To do this, let’s set up a worksheet action by clicking on ‘Worksheet -> Actions’

Create a Set Action by clicking ‘Add Action -> Change Set Values’

Set ‘Area Names Set’ as the ‘Target Set’ and select the ‘Remove all values from set’ radio button for the clearing action

Now, when we click on a bar, it will change the colour palette mark to look at the ‘Age Band’ dimension values instead

Change the colours to your choosing, add labels to the view and format, removing all lines and borders etc

Now all you need to do is create your dashboard, dragging in the sheet and adding a title. In order to show only the legend for the age bands, I also created another sheet for this purpose (otherwise if we used the default legend, it would also include the values for the area names)

Now, we will want to transfer the worksheet action that we created earlier over to our dashboard. You do not need to re-create this as a dashboard action, instead, you can just tweak what you’ve already done.

Click on ‘Dashboard -> Actions’ then tick the ‘Show actions for all sheets in this workbook’ checkbox

Double click the action, then simply change the ‘Source Sheets’ drop-down option from your sheet to the dashboard

And you’re good to go. You now have a dashboard that will add an area name to a set when clicked on and in doing so, will change the colour palette to look at a different dimension.

Very similar functionality could be replicated by using a Parameter Action, however, I chose to use a Set Action as it gives you the option to clear the selection (and therefore return all bars to the original colour) when the action is de-selected. This isn’t possible with a parameter action and to get the same functionality, you would need to build in another button to complete this function.

I hope you enjoyed this post and will stay tuned for the next one!

70 views0 comments


bottom of page