Tableau - Date Differences

Find the difference between two dates using DATEDIFF


                    DATEDIFF(date_part, start_date, end_date, [start_of_week])
                     

The date_part can be:

  • day
  • week
  • month
  • quarter
  • year

[start_of_week] is an optional parameter which can be any day of the week (i.e "Monday", "Tuesday", etc)

Example

Find the number of months between two specified dates


                    DATEDIFF('month',#2017-07-01#, #2017-09-01#)
                     

Find the number of days between two specified dates


                    DATEDIFF('day',#2017-01-01# , TODAY())
                     

Some tips:

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

DATEDIFF with DATETRUNC lets you track date differences without hard coding a specific date.





Services
  • SEO
  • Online Advertising
  • Online Ordering For Restaurants
  • Data Analytics

  • External Resources 4 Developers
  • CSS Tricks
  • MDN

  • Dash-Intel.com is a Power BI and Tableau resource site around data visualizations and building business dashboards.

    Data Analytics consultants in Edmonton, Alberta specializing in Tableau and marketing analytics

    Copyright 2020 Dash-Intel.com Terms / All rights reserved.