2 Replies Latest reply on Feb 26, 2016 6:34 AM by Brian Scelzo

# Grouped Bars with Continuous Lines

Hi guys!  I've been at this particular view for a bit now and I think I'm almost there, but I can't seem to get it to the right conclusion.

Below we have:

Bars:  Grey/2014 Revenue and Pink/2015 Revenue

Lines:  Green/2014 Credits as % of Revenue, Purple/2015 Credits as % of Revenue.

The lines are measured by values on a separate axis.  My dilemma is this:  I need to get the bars grouped by month.  I can do this, but in doing so the x-axis would no longer be continuous, which would cause my lines to segment, in right image. Has anyone ever put together a view similar to that on the right, but with continuous lines?  I run into trouble with the lines primarily because of different years, as you can see in the image on the right, the values aren't connected, the blank space is filled by the other line.

I hope that makes sense, I'd be eager to see what you guys come up with because I'm stuck at this point.

Thanks!

• ###### 1. Re: Grouped Bars with Continuous Lines

Hi Brian!

I'd recommend checking out this blog post from Jonathan Drummey:

http://drawingwithnumbers.artisart.org/bars-and-lines/

There's a sample workbook published to Tableau Public at the bottom of the post.  Hope this helps!

• ###### 2. Re: Grouped Bars with Continuous Lines

Hi Dan - I've reviewed this tutorial before and it was helpful for me to compute a different monthly view for comparing monthly forecast/monthly revenue actuals in the bars  & variance % to forecast in the lines.  Where it was lacking was time-series data with different years to compare.

But I was able to find a solution after reviewing the article you posted again.

1.  Like in the tutorial, transform the current date values to +/- set amount of days so the bars can be grouped on an exact date axis.  Called this calc'd field: Period Transformation

CASE YEAR([Period])

WHEN 2014 THEN DATETRUNC('month',[Period]) - 8

WHEN 2015 THEN DATETRUNC('month',[Period]) + 8

ELSE

DATETRUNC('month',[Period])

END

2.  The using the DATEADD function pushed all date values into 2015.  If year < 2015, add 12 months, if 2015 keep the current date.

IF YEAR([Period Transformation]) < 2015 THEN DATEADD('month',12,[Period Transformation]) ELSE [Period Transformation] END

3.  Dropped this on an exact date axis and now we're set!