When building a Tableau dashboard, the colour scheme is always a key consideration. We know that for discrete values, Tableau will assign a different colour to each member of the field. For continuous values, it will assign a continuous range of colour. Using calculated fields to colour your dashboard based on a condition offers more flexibility and is much more dynamic than using the default colour palettes. In this blog, I will show you a few examples that illustrate this.

Dual Axis Example

In this example, I want to colour the bars based on whether sales reached their target or not. I can do this by creating a simple calculated field, as illustrated below:

By using a calculated field to colour the bars, the view remains dynamic. That is, the colours will update accordingly when new data comes in. This calculation is a simple conditional statement, which acts like a boolean (true/false). Note that the aliases that I have provided in the calculation editor (‘Above Target’ and ‘Below Target’) have been assigned to the colour legend. This is useful because it provides more meaning than a simple true or false. On a side note, I have combined data from multiple sources to create a data blend. If you want to learn more about data blending, click here.

Scatterplot Example

In this example, I have a scatterplot showing how each NBA team performed on offense and defense last season. I want to highlight the teams that had both above average offense and above average defense (i.e. the teams in the top right quadrant). I can do this by creating a simple calculated field, as illustrated below:

As you can see, I have used parameters in my calculated field. Again, this is because I want the view to be dynamic. The parameters control the reference lines, which I have set to the median values across all teams. The beauty of using dynamic reference lines is that they allow the end user to tighten or loosen the criteria for an ‘elite team’ as they see fit. If you want to learn how to create a dynamic reference line, check out my next blog.

Those were a few examples of how you can enhance your visualisation by colouring using calculated fields. I hope you found this blog to be useful!