<< Back

Tableau: Colouring marks using Highlight, Set and Parameter Actions

Ever clicked on a mark on a Tableau worksheet or dashboard and notice the other (unselected) marks would fade out? Well, I personally am not a fan of this default feature because I would still like the other marks to be visible. You can see the fade out that I am referring to in Fig. 1 below.
I was recently directly to Brian Moore‘s blog on how to counter this issue. I will be detailing the steps below to consolidate my learning, and hopefully this may help someone else as well.

Fig. 1: Selecting a mark would default to having the other marks fade out.

There are three methods you can use to achieve this with Tableau’s worksheet and dashboard actions. The actions being: highlight, set, and parameter actions. I will be using Tableau’s Sample Superstore data.

Highlight Action

1. Produce a map of the US states on a worksheet. My worksheet is named Select a State, you can name yours as you wish.
2. Create a calculated field and type in the following in Fig. 2 below. Normally, I would put a blank entry by writing “” but for this example it would help to write NULL Highlight. To iterate, you can write any text you wish.

Fig. 2: Create calculated field. I chose to name it NULL Highlight.

3. Add the NULL Highlight calculated field onto the Detail card in the Marks pane on the worksheet.
4. Make a highlight action with configurations as seen in Fig. 3 below.

Fig. 3: Configuration for the Highlight action.

Click on a mark in the map and you can see how the other states do not fade out as seen in Fig. 4 below.

Fig. 4: Clicking on a mark does not fade out the other marks.

Why does this work?

The NULL Highlight calculated field that we produced in step 2 appends that text to each row in the data. You can see how this looks in the data if you click on View Data in the worksheet as seen in Fig. 5 below.

Fig. 5: Notice how the Null Highlight text is appended at every row in the Sample Superstore data.

What Tableau is doing with this Highlight action, is highlighting every mark in the view. This is because NULL Highlight is attached to every row. This essentially disables the default fade out that we usually see in Fig. 1.

The issue with this is that its not entirely obvious what you have selected. Sure, you can see that the selected mark is slightly darker than the other marks. Or, it has a black outline. However, these finer details are not too obvious for most end users. We can resolve this by using set actions or parameters actions.

Set Action

1. Create a set from the State field. I named the set to Set State.

Fig. 6: Create a set from the State field. You can check whichever state, or even leave all the states unchecked.

2. Drag Set State onto the Color card in the Mark pane.

Fig. 7: Drag the set onto the Color card.

3. Produce a set action with the configurations in Fig. 8 below. Note that the NULL Highlight action is still in effect on this worksheet.

Fig. 8: Configuration for the set action using the set produce in step 1.

You should be able to click on any state, or states, on the map without the other states fading out, and be able to distinguish which state you selected since you have put the set on the Colour card.

Fig. 9: Clicking on state(s) in the map doesn’t fade out the other states, and users can make out which state they clicked on from the colours.

You can take this further. I have made a dashboard where I have the map above and a scatter plot between Profit and Sales with Order ID on detail.
I have also put a table that pops up if the user would like to break down the view to look at the orders for the states they selected.

Fig. 10: Dashboard that allows users to select the states that they would like to colour the orders by in the scatter plot, and the ability to drill down to the orders in the states selected.

Parameter Action

1. Produce a map of the US states on a new worksheet. Drag the NULL Highlight field onto Detail. Add the Highlight action for this new worksheet.
2. Create a parameter as seen in Fig. 11 below. The data type should be string and I have named it Select State. You can name the parameter to what is convenient to you. I have put in State in the Current Value section. You can put anything in there.

Fig.11: Set the date type to string. You can enter whatever you like in the Current Value section.

3. Create a calculated field using the parameter created above.

IF [State] = [Select State] THEN 'COLOUR'

Fig. 12: Create this calculated field to colour the selected state with the parameter.

4. Drag the new calculated field [Parameter – Select State] onto the Colour card in the Marks pane.
5. Produce a parameter action in the worksheet with the configurations as seen in Fig. 13 below.
Note how the NULL Highlight action is set up for that worksheet as well.

Fig. 13: Configuration for the parameter action. Use the parameter built in step 2 as the Target Parameter.

After configuring the parameter action, you can click on any state on the map and the selected state will be coloured differently to the other states that were not selected. Since the NULL Highlight action was also configured for that worksheet, the other states do not fade out.

Fig. 14: After enabling the parameter action, you can click on a state and see it change colour. You can also see the Select State parameter update depending on what state you click on the map.

Since it is a parameter action, this can only work by clicking on one mark at a time. You cannot select multiple marks like you do with sets. Also, we could achieve the same thing in this parameter action example with a set action as well – where we only want one selected mark at a time.
This can be done by revisiting the set action configuration in Fig. 8 above. You need to check the Run on single select only option. This makes sure that Tableau will only allow the user to click on one mark and have it coloured. If the user chooses multiple marks then nothing will happen.

Fig. 15: Check the Run on single select only in the set action configuration.

Similar to Fig. 10 above, here is a dashboard that achieves the same thing when clicking on a state to colour the orders in the scatter plot adjacent to the map.

Fig. 16: Parameter action used to colour the individual orders in the scatter plot depending on the state selected in the map.

I have made downloadable workbooks for the set action and parameter action examples if you would like to see how it was done.

I hope you have found this blog useful. Thank you, Brian Moore, for your blog because I certainly found these tips useful when building dashboards for clients.
Please let me know if you have any questions in the comment section below.

Leave a Reply

Your email address will not be published. Required fields are marked *