When you’re going to compare two metrics of comparable sizes in a XY plane, it’s sometime useful to add a 45 degrees reference line (in geometrical terms, a bisecting line). This is extremely useful, among other cases, when you need to compare an above-the-line/below-the-line performance. A typical example, discussed here, is when you need to compare if the channels of incoming visitors to a website are more capable of attracting new rather than returning visitors.

Technically speaking, Tableau doesn’t allow to draw diagonal reference lines, but this could be done with a very simple trick I’m going to explain here. I tested on Tableau Professional 9.0, but it should work with other versions as well.

First of all, I put the measures on X and Y axes. In my case, I already had New Visitors Sessions and Returning Visitors Sessions measures on a dataset which was built using the standard Tableau Google Analytics Connector. I used a circle marktype and I coded with colors the Default Channel Grouping attribute, to have a clear distinction between incoming traffic channels.

To have a better idea on if the traffic is qualified or not, I coded the Average Pages/Visits measure with size. This metric was not directly available on the data set, but It was easily built with a calculated field named Pages/Sessions and simple formula:


After adjusting label and tooltip, I ended up with this graph (click to enlarge):

45 degrees reference line in Tableau

Ok, this is a nice visualization already, but it doesn’t immediately tell if a specific channel is more capable of driving traffic from new or returning visitors. That’s why we need a bisecting line.

The trick here is to build a calculated measure that is a simple copy of the measure we put to the columns axis and to put it in the rows axis. Use a line marktype and a neutral color (ie medium gray). Use the same aggregation operator of your metrics, put in dual axis and you’ll get something very similar to the screenshot below (the pop-up on top is to show how the formula for the calculated field is made).

45 degrees reference line in Tableau


This is definitively a 45 degree reference line, but it doesn’t look very nice, doesn’t it?

To have a continuous line that starts from the origin of the axes, right-click on the 45 degree line, then on Trend Lines and on Show Trend Lines. Now make your original 45 degree line 100% transparent within the Color options and apply a bounce of graphic formats to the trend line as your tastes. At the end of the day, you should end up with something like the screenshot below.(click to enlarge):

45 degree reference line on Tableau


Tah-dah! A very nice and elegant 4-clicks graph that will let you making immediate comparisons between two metrics in a plane.

If you enjoyed this tutorial, or you have questions or suggestions, feel free to leave a comment here below. Meanwhile, stay hungry and happy coding!


Share This