Using Date Constants in Tableau Calculated Fields

This is a method you can use when writing calculated fields that compare against a specific date.

Using Date Constants in Tableau Calculated Fields

When writing calculated fields in Tableau that compare against a specific date, you need to enclose the date in # symbols.

DATEADD('day', 10, #1/20/25#) = #January 30, 2025#

DATEDIFF('day', #3/10/2025#, #3/20/2025#) = 10

DATEPART('year', #2025-05-13#) = 2025

Without a date literal, Tableau may interpret the value as a different data type, so be careful when using it.

Date Functions
Dates are a common element in many data sources