KNOWLEDGE BASE

Displaying Dates Not in your Data Source on an Axis


Published: 17 Jan 2017
Last modified date: 20 Jul 2023

Question

How to display dates which is not included the data source as an axis?
For example, the data source has data starting from 01/01/2011, but you want to display 01/01/2010 to 31/12/2010 on an axis.

Environment

Tableau Desktop

Answer

Step 1: Create a Placeholder data set with the following structure: 
Record 



See the attached placeholder placeholder data.xlsx file for an example. 

Step 2: Connect to the data 
  1. Connect to placeholder data.xlsx. 
  2. Connect to sample SuperStore data set. 

Step 3: Create Start and End Date Parameters 
  1. In the Data window, click the drop-down arrow at the top right of Dimensions, and then select Create Parameter
  2. In the Create Parameter dialog box, name the parameter. In the example workbook, the parameter is named Start Date
  3. Under Data Type, select Date
  4. Under Allowable values, select Range
  5. Set the minimum value to 1/1/2010 and the maximum value to 31/12/2011. 
  6. Under Step Size, select 1 (months). 
  7. When finished, click OK. 
  8. Right-click the parameter and then select Show Parameter Control
  9. Repeat steps 1-7 to create an End Date parameter. 

Step 4: Create a Date Calculated Field 
  1. With placeholder data selected, select Analysis > Create Calculated Field
  2. In the Calculated Field dialogue box that opens, type a name for the field. In this example, Order Date
  3. In the Formula box, type the following formula: 
CASE [Record] 
WHEN 1 THEN [Start Date] 
WHEN 2 THEN [End Date] 
END 

Step 5: Create the View 
  1. Drag Order Date from the Placeholder data set to Columns. 
  2. Right-click Order Date on Columns and select Show Missing Values. 
  3. Drag Sales from the SuperStore data set to Rows. 
  4. Click the indicator and select Show data at default position.
Did this article resolve the issue?