Some [Date]-ing advice: A cheatsheet for Tableau date functions

Tableau date functions confusing you? Me too!
So here's a cheatsheet for both of us:

Returning Part of a Date

DATEPART & DATENAME:
Return a specified part of the given date (e.g. day, month, year) as an integer or a string respectively.

Example (where [DATE] is 15 October 2026):

Plain text
 DATEPART('month', [DATE])   // returns 10
 DATENAME('month', [DATE])   // returns "October"

DATEPART returns the month as an integer, in this case October as 10, while DATENAME returns it as the string "October".

Adding and Subtracting Dates

DATEADD:
Adds a specified amount to the given date and returns the new date. This can be used to add time to a date or take time away.

Example (where [DATE] is 15 October 2026):

Plain text
DATEADD('day', 2, [DATE])    // returns 17 October 2026
DATEADD('day', -2, [DATE])   // returns 13 October 2026

If the amount is positive, DATEADD adds to the date, and if it's negative, it subtracts.

DATEDIFF:
Returns the difference between two dates in the specified date part (e.g. days, months).

Example (where [DATE] is 15 October 2026):

Plain text
DATEDIFF('month', #2026-02-15#, [DATE])   // returns 8

DATEDIFF subtracts the first date from the second and returns the difference in the date part you give it.

Creating Dates

DATEPARSE:
Converts a string in a specified format to a date.

Example:

Plain text
DATEPARSE('dd/MM/yyyy', "15/10/2026")   // returns 15 October 2026

The string "15/10/2026" and its format were input into DATEPARSE and a date can be read from it. 'M' should be used for month since 'm' is for minutes.

MAKEDATE:
Returns a date from a year, month and day given as numbers.

Example:

Plain text
MAKEDATE(2026, 10, 15)   // returns 15 October 2026

The values should be input year first, then month, then day.

Truncating Dates

DATETRUNC:
Truncates the given date to the start of a given period.

Example (where [DATE] is 15 October 2026):

Plain text
DATETRUNC('month', [DATE])   // returns 1 October 2026
DATETRUNC('year', [DATE])    // returns 1 January 2026

I hope this helps. Happy [Date]-ing!

Author:
Darrell Barovbe
Powered by The Information Lab
1st Floor, 25 Watling Street, London, EC4M 9BR
Subscribe
to our Newsletter
Get the lastest news about The Data School and application tips
Subscribe now
© 2026 The Information Lab