Moving a Reference Line to the Back?

Can you move a Reference Line to the Back in Tableau?

Why yes you can!



Ok....you can sort of....

In the current version of Tableau, there is no option to Move a Reference Line to the back. It just doesn't exist, not sure why, just doesn't. However, you can move Reference Bands are in the Back.

So, if Reference Bands are in the Back, that means we could just create a very very small band, that looks like a Line.

In this example, I am going to create a "Reference Line" for Average.

Step 1. We need to create the Band, so to do so, we need to create an Upper and Lower Limit. For ease of use, one of the Limits is simply going to be the Avg of our Measure Summed.


Now we need to set an Upper Limit, somewhere the Band can go to. But we need this to be only slightly greater than the Average Measured Summed. So we need to create a small table calc to simulate it.

Step 2. Create the Upper Band Table Calc.

WINDOW_AVG(SUM([Sales])) * 1.005

The "Exact" amount to multiply by is a guessing game, you will just have to play around until you find an amount that works. If you wanted to really dig in, you could probably come up with a Method that looks at the Container Height (On the Dashboard) and Compares that with the Range of Values, then based on those variables decide the upper band limit. But I'll leave that for another time.

Step 3. Drag the Calculated Field onto the Detail Mark


Step 4. Create the Band.

Right Click on the Axis and Click Create Reference Line.

Next Choose Band


Set the Band From to the Avg of your Measure, and change the Label to Value


Set the Upper Band to the Table Calc we created, turn off Label.


Finally, make sure the Line is Off, and you set the Fill.


And just like that...we have a "Reference Line" behind our Bars! This method isn't perfect, but it is an alternative solution, and may help you free up that Dual Axis!


Thanks for reading!

Previous
Next Post »
2 Comment