Tableau: proportional brushing with set actions

by Andrew Lehm

Set actions have been out for a while now but one of my favourite uses (and probably the easiest to pick up) is proportional brushing.
Essentially, proportional brushing allows you to set up a dashboard action to enable you to use a dimension from one chart, to highlight a section of another chart, without that dimension needing to be in the view of the second chart.

Hovering over the relevant Segment highlights the sum of sales in each Sub-Category that are part of that segment

The first step is to create two worksheet, one with the dimension that you want to brush the second sheet with.
In this case I have just created a bar with the segments on and a label for Sum of Sales and Segment, you can use another chart if you want to.

To create the top chart I used a trick I picked up from a workout Wednesday that uses the Gantt mark type to create a solid bar for the fields within a dimension.

Add the dimension to rows. This will just create three thin vertical lines, so we need to create a custom measure to size the bars. To do this just double click on the marks card to open a type in bar and just put in ‘1’.

Create a Gantt for each Segment

Convert this measure’s aggregation from Sum to Average and drop onto the size shelf.

Give the Gantt bars an end point

Now just add the Sum of Sales onto the Text card and I also dragged Segment onto the Text shelf too.

The next step is to create the second chart, the one that you want to brush.
I created a simple bar chart with Sub-Category on rows and Sum of Sales on columns.

Simple bar chart

To enable the segment to dynamically colour the bar chart, we need to create a set for our set action.
Right click on segment in the data pane and select create > set

Name your set and select one of the fields.

Now drag the set onto colour.

If you look at the colour legend, you’ll see that Tableau automatically puts ‘In’ on top of ‘Out’. However, it is better practice to see what you’re highlighting on the bar chart start at the zero lines, making comparison between fields easier, so right click on the ‘In’ to below the ‘Out’.

The final stage is to put both the worksheets on a Dashboard and to configure the set action.

Once you have both sheets on the Dashboard, click on the Dashboard drop down and select Actions.

Within the Actions pane, select the option to Change Set Values

We need to configure this option correctly.
Name the action; select the source sheet (the Gantt of Segments); and when to run the action (on Hover, Select, or Menu); tell Tableau the data source the target set is based on; and which set we’re changing the action for (the one named Segment set I created earlier); and what to do upon clearing the selection. If I selected keep selected values the bars would stay highlighted until I hover over another Segment; if I selected add all values, the entire bar would turn dark blue when I move off a particular segment; Clear all values is what I choose for proportional brushing to really highlight just the segment I am hovering over.

Click OK and you’re ready to go!