Tableau Set Actions
In the upcoming 2018.3 release of Tableau Desktop (currently in beta), there will be two new dashboard Actions:
- Go to Sheet
- Change Set Values
This blog post takes a look at Set Actions and some of the potential use cases, such as:
- Proportional brushing
- Dynamic Viz-in-Tooltips with hierarchical selection
- Customised highlighting actions
Some of the techniques I’ll look at are already possible via filtering and calculations, however, set actions make this easier and provides more control over the end result.
Andy Cotgreave recently wrote a post on how the new set actions can be used to achieve proportional brushing and I think this could be one of the common uses of set actions as it makes the process quicker and easier. Without set actions, this technique is usually achieved using a dual axis chart and a fixed LOD and then using either a quick filter or an action filter between two charts. For example, the dashboard below shows sales by segment at the top and sales by sub-category underneath. There’s a filter action from the top chart the bottom chart.
Dashboard with no selection:
Below is the dashboard after clicking on the Corporate segment, showing what proportion of Corporate sales come from each Sub-Category of product:
The grey bar, made with a fixed LOD, does not get filtered because the action filter happens after the fixed LOD in Tableau’s order of operations
The view for the sub-category chart is setup as shown below. You can see the dual axis and the auto-generated filter action set on the Filters shelf:
Here’s how we can achieve the same end result using Set Actions:
- Create the same Sales by Segment chart
- Create the same Sales by Sub-Category chart, but with just one Sales measure, so no dual axis
- Create a set from the Segment dimension called “Segment Set”
4. Put this set on the colour shelf of the Sales by Sub-Category chart
5. Place these two views on a dashboard
6. Go to: Dashboard > Actions > Add Action > Change Set Values…
7. Configure the action as below:
These settings determine:
- Which sheet will update the set: the “Segment – PB New” view.
- How it will be updated: By selecting (i.e. clicking on a bar on the above sheet)
- Where the set has been created: In the Sample – Superstore data source
- The name of the set to update: “Segment Set”
- What will happen when you clear the selection: All Segments will be added back into the set
Now when you click on a segment bar, the Segment Set is updated to only contain that selected segment. This results in the sub-category bars being coloured proportionally based on the sales that are from the selected segments (i.e. IN the Segment Set) and those that are not (i.e. OUT of the Segment Set), as demonstrated in this video:
The key point, in this use case, is that no data is being filtered out of the view. The Set is just being used to encode the marks in the view.
Dynamic Viz-in-Tooltips with hierarchical selection
In version 10.3 Tableau introduced “Allow selection by category”, which provides the functionality to make new mark selections from within a tooltip by clicking on a dimension value that has been added to the tooltip.
Combining this feature with Set Actions opens up interesting ways to modify the view, including the viz-in-tooltip that is showing in the same tooltip where you make a selection by category.
In the following example, I have created a set called “City Set” that is updated via a set action on the map worksheet. The set action is triggered whenever the user selects marks in the view, or by making a ‘selection by category’ from the tooltip.
The City Set has been placed on the filter shelf of the view that is used for the viz-in-tooltip, so that view will only show the selected marks.
With the ability to alter the selection of marks from within the tooltip (up and down the geographic hierarchy: Sales Area > Country > State > City) the viz-in-tooltip then becomes dynamic based on those selections, as shown in the video below:
This allows the user to change the granularity of the treemap view, while also seeing the selection of marks in the background map change, giving a good sense of context of what cities are included in the treemap.
Some additional calculations have been used to only show text labels in the treemap for the geographical levels that are required at that level. At the single city level, some additional “% of total sales” metrics are displayed for that city.
The below screen shows the configuration of the set action:
And below, the treemap (viz-in-tooltip) worksheet with the City Set on the filters shelf:
Note that, to use set actions with a viz-in-tooltip in this way, you must remove the “<All Fields>” part of the generated text when you insert a sheet into a tooltip because you don’t want to pass through any filters – as the filtering is performed by the set:
<Sheet name=”Sales & Profit Treemap” maxwidth=”700″ maxheight=”400″ filter=”<All Fields>“>
<Sheet name=”Sales & Profit Treemap” maxwidth=”700″ maxheight=”400″ filter=””>
Customised highlighting actions
With Tableau’s current Highlight Actions you can highlight marks in one view by selecting or hovering over corresponding marks in a different view. Here’s an example of this effect created by selecting marks in a bar chart which triggers a highlight action to occur on the corresponding Segment and Year combinations in the table of figures below the chart:
No one could deny that the cells in the table are highlighted, however if you don’t like yellow boxes then you’re going to be disappointed as you can’t change that formatting.
With set actions a similar effect can be achieved by creating a set as we saw in earlier examples and then placing that set on the colour shelf of the table sheet. By modifying the colours associated with members IN or OUT of the set, you can now set the effective ‘highlight’ colour to be whatever you want.
Note, in this example I had to create a new calculated field that combined Segment and Year (of Order Date) and then create a Set from that new field, as using separate Segment and Year sets resulted in marks that were included in either of the sets being highlighted.
Below is an example. To aid in understanding, I’ve added a simple sheet that shows the members of the set on the right-hand side of the dashboard so you can see this update as selections are made:
You could, if desired, also add a second dimension to colour to achieve different shades of highlighting.
The real advantage of using sets in this way is the flexibility of how they can be used to encode data. Instead of highlighting the cell, we could colour and/or change the size of the text. In the following example I actually coloured the non-selected corresponding marks light grey and made their size smaller so that they faded to the background:
Another advantage of using set actions is that, if you’re using a dual axis, you can apply the set encoding to just one marks card rather than both, which would happen with standard highlight actions. Below is an example of the standard highlight action on a chart. Marks of the highlighted year remain the same colour (both the bar and circle) and all other marks are dimmed.
Using the same chart with a set action, I’ve put the Year Set on three shelves to encode colour, size and shape for only the circle mark, leaving the bar formatting unchanged:
I’m not suggesting this is visual best practice, however, it hopefully demonstrates the extra flexibility that set actions provide for highlighting in different ways and with much finer control.
Finally, many thanks to Filippos Lymperopoulos (@flymperopoulos) and Allison Whilden (@awhildy) from Tableau’s Product Development Team who are working on this feature and took time to talk with me about the functionality and some test cases I was working on.
To see other upcoming features in Tableau, visit this page: https://www.tableau.com/products/coming-soon
Update: Adding a link to the workbook used in this blog post now 2018.3 has been released: https://t.co/sNgVXdVOvu