KNOWLEDGE BASE

Date Calculations, Filters, and Time Stamps Show Unexpected Results After Publishing


Published: 01 Oct 2013
Last Modified Date: 22 Nov 2016

Issue

After publishing a workbook or data source, calculations based on NOW() or TODAY(), Relative Date Filters, and time stamps (such as last updated) show unexpected results. The calculations, filters, and time stamps appear to be computed in a different timezone.

Environment

Tableau Online
Tableau Server

Resolution

To adjust the time zone of date and date/time fields that are displayed in the view:

  1. Open the workbook in Tableau Desktop.
  2. Select Analysis > Create Calculated Field.
    • For a date/time field, create a calculation similar to the following:
      DATEADD('hour',<number of hours>,[<datetime field>])
    • For a date only field, create a calculation similar to the following:
      IF DATEPART('hour', NOW()) > <PST time of midnight> then DATEADD('day', 1, <datetime field>) else <datetime field> end
  3. Replace the date/time field used in the view with the newly created calculated field.
  4. Re-publish the workbook or data source.


To replace a Relative Date Filter with a calculation that filters to the most recent hour in the dataset:

  1. Create a calculation such as the following:
    [DateTimeField] >= {FIXED: MAX(DATETRUNC('hour',[DateTimeField]))} 
  2. Place the calculation on the Filter Shelf, choose to show "True" 


To replace a Relative Date Filter with a calculation that filters to "this hour" in the desired timezone:

  1. Create calculation such as the following. Note, the following converts from Pacific Time (Tableau Online 10ay) to Eastern Time (hypothetical user):
    [DateTimeField] >= DATEADD('hour', 3, NOW()) 
  2. Place the calculation on the Filter Shelf, choose to show "True" 

Cause

After publishing a data source or workbook, NOW(), TODAY(), Relative Date Filters, and time stamps are localized to the timezone of the Tableau Server or Tableau Online.

 
Did this article resolve the issue?