This article is written while using Tableau 2019.4.1.
To ease myself into this whole blogging thing, we’ll start off with a simple tip, one that I only found out a few months ago: replacing fields in a viz by double-clicking in an existing field. This will make Tableau remember any of the sorting or colour settings.
What do we mean by this? Let’s explore this concept with a couple of examples using the Superstore Sales data set.
Replacing Fields in the Rows Shelf
For our first example, say we have a simple bar chart showing the Sales by Sub-Category and sorted by descending Sales:
Suppose you want to duplicate this chart and replace
If you’re like most people I’ve worked with – which includes me until recently – you would probably drag
[State] from the Data Pane and place it on top of
[Sub-Category] in the Rows shelf. This will return the following viz:
What you will notice immediately is that Tableau has removed the sorting. Now if we want to keep the sorting, what we can do instead is to double-click on the
[Sub-Category] field on the Rows Shelf. Doing so will give us the ability to type in a different field name.
Now when we type in State and press Enter, Tableau will keep the sorting on descending sales.
Replacing Fields in the Shapes and Colours Shelf
Let’s look at another example with regards to shapes and colours. Suppose we have the following calculated field
[Sales Target Met] :
IF SUM([Sales]) < 100000 THEN -1 ELSEIF SUM([Sales]) <150000 THEN 0 ELSE 1 END
We then use the
[Sales Target Met] field in the Shapes and Colour shelves to build a viz like this:
Next we create a calculated field
[Quantity Target Met]. Make sure that this field returns the same values as
[Sales Target Met].
IF SUM([Quantity]) < 2000 THEN -1 ELSEIF SUM([Quantity]) < 3000 THEN 0 ELSE 1 END
Now we will drag and drop the
[Quantity Target Met] on to the
[Sales Target Met] fields in the Colour and Shape shelves. As you might expect at this point, Tableau resets the Colour and Shape settings.
We can use the same technique again to keep the colour and shape settings. Double-click in the
[Sales Target Met] fields and replace it with the
[Quantity Target Met] field.
There is a caveat when using this technique with colours and shapes however: it only works if you have never set the colours or shapes for a specific field. Once you have done so, Tableau will ‘remember’ these settings and will lock them in. For instance, if you now change the colour of
[Sales Target Met], Tableau will not update
[Quantity Target Met] with the changed colours. So whenever possible, you should finish building the viz for a single target first before adjusting the others.