Tableau - Adding Dates

To return a future or past date in Tableau use DATEADD


                    DATEADD(date_part, interval, start_date)
                     

The date_part can be:

  • day
  • week
  • month
  • quarter
  • year

Example

Add 1 month to 2017-09-01


                    DATEADD('month', 1, #2017-09-01#)
                     

Find the date 7 days ago


                    DATEADD('day', -7, TODAY())
                     

Some tips:

  • Change data type to date
  • Change data type to discrete

These calculations come in handy when you need to look at project deadlines, forecasts or look back at advertising spend from 7 days ago to calculate ROI.


Dash-Intel is a Power BI and Tableau resource site for data visualization and building BI dashboards.

Data Analyst & Consultant

Copyright 2015-2023 Dash-Intel.com Terms