Data Viz Done Right

April 12, 2014

Tableau Tip: Moving reference lines behind bars


Reference lines are wonderful. If done well, they can add so much context at a glance with very little effort to include them in your viz. However, reference lines in Tableau always sit on top of the rest of the viz. We may not want them to be so prominent though.

Wouldn't it be great if we could place them behind the bar, kind of like how you can decide which objects to move backwards on a PowerPoint slide?

First, let's build a simple bar chart of Sales with a reference line for Budget Sales.


If we click on one of the reference lines and then right-click, we don't have an option to move the marks to the back.


There's a super simple trick to move the reference lines to the back...Gantt bars!

Step 1: Move Budget Sales from the Detail shelf to the secondary axis of the chart.


Tableau will change the marks for both axes to circles.


Step 2: Right-click on the Budget Sales axis and choose Synchronize Axis.

Step 3: On the Marks card, click on All and drag Measure Names off of the color shelf.


You should now have only blue circles like this:


Step 4: Click on SUM(Sales) on the Marks card and change the Mark Type to Bar.


Step 5: Click on SUM(Budget Sales) on the Marks card and change the Mark Type to Gantt Bar. But now it looks like the bars disappeared, so we have to make a couple other adjustments. We can’t see them because they’re blue and the same width as the bars for Sales.

Step 6: On the Size shelf, change the size of the Gantt Bars to the maximum size. This will make them the width of each cell.


Step 7: Click on the Color shelf and make the bars black.


Step 8: Right-click on the Budget Sales axis and choose Move Marks to Back.


The "reference lines" are now behind the bars.


Step 9: The final step is to right-click on the Budget Sales axis and uncheck Show Header.


Download the workbook here.

Note: This is my first blog post using Tableau for Mac. I've been testing the alpha since January and am happy that it's getting to the point where I feel comfortable using it first.


  1. The workbook you posted cannot be opened by Tableau 8.1 for the lowly Windows user ;) Just upgraded to Tableau 8.1.6 (Windows), the latest Desktop version that fixes the Heartbleed vulnerability. I suspect it is because you created the workbook using Tableau for Mac. Glad to hear that the Mac version is coming along so well.

    -Steve Mayer

  2. Steve, you should be able to open the workbook with the 8.2 beta.

  3. Andy- I LOVE this tip! I had one data item to show and wanted the average for all of the categories being shown, so it was a smidge different than your example. I used the windows_avg to create a calculated field, which became the second data item/reference line and followed the rest of steps and it was like tableau magic! Awesome!