Date Calculations in Tableau

Tableau has lots of useful calculations for date fields, here are a few:

Tip: Date_part can be 'day', 'week', 'month', 'quarter', 'year', 'hour', 'minute', 'second'. There is also 'dayofyear' e.g. Feb 1 is 32, and 'weekday' e.g. Monday, Tuesday. The date_part needs to be in quotation marks, lowercase, and singular e.g. not 'days'.

DATEADD

DATEDIFF

Make sure the first date is your starting date. In the sample superstore dataset, you can calculate the difference between the order date and the shipping date to calculate 'days to ship'.

DATENAME

DATEPART

Author:
Georgia Webb
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
© 2024 The Information Lab