4 Replies Latest reply on Nov 9, 2016 1:06 PM by Pavani Donepudi

# Line chart with a 6-6 month comparison

Hi,

I have a simple line chart with a monthly trend of Cost for 'latest' 12 months. I am trying to change this chart to depict a 6 monthly change in cost. So, I would like to show a trend of cost latest 6 months over previous 6 months. I have attached a sample workbook. In trial sheet, I tried to compare but I can only compare by Year to Year which is not what I need.

It seemed like a very simple thing to do, but I am unable to find any option to do this!

I would greatly appreciate any help! Thank you.

• ###### 1. Re: Line chart with a 6-6 month comparison

Is that what you wanted?

Calculation1: This returns data Mar'16-Aug'16 (Last 6 months)

Calculation2: This returns data Sep'15-Feb'15 (Last to last 6 months)

I guess you're using some older version however workbook (version 9.3) attached for your reference. Let me know If you've any query.

Mahfooj

• ###### 2. Re: Line chart with a 6-6 month comparison

I am assuming that you wanted a line chart of latest 6 months with a comparison line chart of prior 6 months. Please go through the link provided below that explains in detail how to compare 2 date ranges on one axis.

Tableau 201: How to Compare Two Date Ranges on One Axis

If you follow through the link, most of the data setup is already in placed in your example workbook - I have added Date Equalizer as shown below -

I have added 6 months if the date happens to be part of the prior 6 month period, so that the date is normalized for comparison.  Once complete, just bring this date field on to the columns and the Cost Current and Cost Previous as measures..... and you should have your chart as below -

• ###### 3. Re: Line chart with a 6-6 month comparison

Thank you! This worked like a charm. Instead of [Date], I put in text 'Previous 6 Months' &'Latest 6 Months' and I was able to create the trend as expected!

• ###### 4. Re: Line chart with a 6-6 month comparison

Glad you got  what you want.