Quick tip to finish the week.

This week at work I was asked whether we could show two dimensions where one would be showed as a dashed line.

I can’t replicate the data here but I’ve created an example below, the idea is to show my fruit and veggies consumption(solid lines) vs the goal or daily indicated intake(dashed lines):

My first thought was to suggest something like this, where we use two dimensions in the colour shelf. I’m always trying to favour the off the shelf solution at work as it’s easier to maintain going forward.

The way to do this is to bring the first dimension to colour and the second dimension to detail. After that change the second dimension from detail to colour. See below:

Normally this would be the way I’d go about doing it, but this particular chart was going to be shown on a projector where the light colours won’t show very well. So we were back on the original request of a solid and a dashed line.

My next option would be to duplicate the dimensions and create a double axis using two measure values, but this isn’t yet possible. Vote here if you think that would be a good addition to Tableau. Multiple Instances of Measures Names/Values

So as an alternative I though I could split one of the dimensions and change the chart types.

First step was to create a measure field for the actual and goal values as these would be the different chart types.

Repeat the same for Goal.

When creating the chart instead of using the Value measure, I used the newly created measures and create a double axis where my Actual value is a line and the goal I change to a Gantt chart.

And there you have it, a dashed and a solid line with very little effort.

I can see this being handy in financial data or when having a goal vs the actual value, like food intake, or target running speed.

Sure you can also use a reference line for the target/goal, but that wouldn’t allow you to have different colours for each category.

I hope you have found it useful and thank you for reading.

David