KNOWLEDGE BASE

Comparing Two Date Ranges from the Same Data Set on One Graph


Published: 12 Apr 2013
Last Modified Date: 20 Nov 2017

Question

How to compare two date ranges from the same data set on one graph.

Environment

Tableau Desktop

Answer

The following instructions use the Sample - Superstore data source.
  1. Create a calculated field for the first date range. The example below uses the year 2013:
    date(IF year([Order Date])=2013
    THEN [Order Date]
    END)
  2. Create a calculated field for the second date range. The example below uses the year 2014:
    date(IF year([Order Date])=2014
    THEN [Order Date]
    END)
  3. Place both calculated fields on the Columns shelf, selecting Continuous, Exact Date.
  4. Right-click the second date range and select Dual Axis.
  5. Drag Sales to Rows.
  6. Drag Order Date to Color on the Marks card for All.
Did this article resolve the issue?