Topics: 4 min readtime

Multi-Dimension Bars!

Written by Andrew Lang
Tuesday 29 December, 2021

Multi-Dimension Bars!

The inspiration for this blog came recently while working on a project for a client. The brief was to re-create a specific view of the data, the analysis being performed was looking at three different Traffic light scores in one bar chart view:

Customers in Score Category bar chart


This took a little moment to figure out what to do. In the end we came up with two options

  1. Choose a different chart type to visualise these scores.

  2. Build out three different charts, one for each RAG score and combine them on the dashboard using containers.

In the end we went with option 2 as the brief was to stick as close as possible to the original view for now and to explore alternate views a little down the line.

But the original ask still intrigued me, could I build out the requested view and would it look any good?

Now the reason this is a challenge in Tableau is that you can't place dimension axis next to one another like this on a view. When we add multiple dimensions to rows or columns the logic Tableau uses is that you are breaking down the first dimension by the second, then the third and so on.

Tableau way of working with dimensions


However you can achieve this ‘side by side’ look with continuous axis, for example if we look at regions by sales and profit:


Multiple axes in Tableau Desktop


Here we can see one axis next to another, creating the effect of having two charts side by side. So my thought was that I could exploit this, but somehow i needed to convert categorical RAG scores onto a continuous axis. I was able to do this with the Index() table calculation. With index I can compute along the RAG score to identify the ‘position’ that the score will occupy on the axis.

I decided to start with just one to begin with, so i added Number of orders to the rows shelf, and created a quick calculation on the columns shelf by double clicking and typing Index();


Tableau Index() table calculation


The next stage was to add the first of my three RAG scores to the colour shelf of the marks card to add them to the view level of detail:


Add the index() calculation to our Tableau view


Now to get the dots positioned correctly I changed the compute by on the index() pill to ‘Profit RAG’


Change compute using table calculation


Now I could change the mark type to bar:


Change mark type within Tableau Desktop

Finally to get the RAG scores in the right order I have edited the default sort for the RAG Score Dimension:


Change sorting within Tableau


Now to get the other two charts ‘side by side’ I duplicated the index() field in rows by holding control and dragging next to itself twice.


Duplicate a field within Tableau Desktop


Then in the marks cards for the two new index() axis i replaced the original RAG score dimension with the others, making sure for each axis to change how index() was computing to ensure it was computing by the correct field:


Change compute using Tableau Desktop



Result of changing table calculation settings


Finally some last bits of formatting, I decided to make the bars 1 axis unit wide, and to move the Score labels to the bottom of the bar, i also edited the lines on the view to show just axis rulers, and changed the index() axis labels to reflect the score being shown:


Change axis values Tableau Desktop


These changes give us the final result below:


Final Tableau Desktop results


Overall a pretty good re-creation I think. In terms of maintenance this should be fairly low maintenance for anyone that knows table calculations and how to set default options. Changes may need to be made to default sort or to default colours if a new banding is added in a RAG calculation, or is drawn through from the underlying data.

I’m sure i’m not the first person to come up with this approach, but this was a fun little challenge to try and come up with a way of doing this.