Over the past four months, we’ve come across countless ways to visualise data. One method I have found particularly useful to draw insights is the selection vs others set action in Tableau. I discovered this method from our training on set actions, in a video by Bethany Lyons. I have adjusted it for my purposes and will show you how I created it for¬†this¬†Makeover Monday.

The Base

The selection vs others set action uses a bar chart which looks at a given metric sliced by a dimension, and a line chart that shows the given metric over time. The set action allows the user to select a discrete value from the bar chart to show its trend over time. The bar chart uses the measure count of eviction id, and the dimension is eviction reason. The line chart also uses the count of eviction as the measure. It is important to use the same measure for both the bar and line chart, otherwise the colouring will not work.

The Calculations

1. Create a set from the dimension you are slicing the bar chart by (eviction reason in this case)

2. Create a calculated field that allows you to select a value (eviction reason) to show on the line chart. Note the else condition ‘All Other Reasons’, which will aggregrate all the eviction reasons not included in the set and show them as an ‘other’ line:

3. Drag this calculation to the level of detail and sort it by the measure you want (count of eviction id in this case) in descending order. You can also add it to label for extra clarity.

4. Sort the bar chart the same way using the field you used in the above calculation (eviction reason in this case). This will make sure the colours match for the set action.

5. Create a calculated field from the set to colour the selected bars and corresponding lines, as shown below:

6. Drag it to colour for both the bar and line chart. Make sure it is discrete and check that the table calculation is configured correctly.

The Set Action

The last thing to do is setting up the set action on your dashboard. Once you bring your bar and line chart into the view, it’s a very simple process. Just add a set action, using the bar chart as the target sheet and the set we created earlier as the target set. Here is a demonstration:

Note that I set it to clearing the selection will remove all values from set, so that the user can look at different combinations of eviction reasons on the line chart.

Now we have a selection vs others set action! It is a simple yet effective way to visualise a given measure, first slicing it by a dimension and then drilling down to look at how it has changed over time. I hope you found this blog to be helpful!