4 Replies Latest reply on Oct 3, 2018 9:33 AM by meenu choudhary

    Difference between dates


      Hello, I wanted to know if there is a way to count the difference between two dates in Tableau eg- the difference between 10/3/2018 and 10/13/2018 would be 10 days so can anyone explain how to get this or any share any source? Thank you

        • 1. Re: Difference between dates
          Michael Ye



          Michael Ye

          1 of 1 people found this helpful
          • 2. Re: Difference between dates
            suman kumar



            Use DATEDIFF function for difference.



            DATEDIFF('day', '10/3/2018' , '10/13/2018')


            you can use month, year, day, week instead of day according to your requirement but it should be in small letter. and then use date from which you want to subtract it. and then use which you want to subtract.



            DATEDIFF(date_part, date1, date2, [start_of_week])

            Returns the difference between date1 and date2 expressed in units of date_part.

            The start_of_week parameter, which you can use to specify which day is to be considered the first day or the week, is optional. Possible values are 'monday', 'tuesday', etc. If it is omitted, the start of week is determined by the data source. See Date Properties for a Data Source.

            Supports ISO 8601 dates.


            DATEDIFF('week', #2013-09-22#, #2013-09-24#, 'monday')= 1
            DATEDIFF('week', #2013-09-22#, #2013-09-24#, 'sunday')= 0

            The first expression returns 1 because when start_of_week is 'monday', then 22 September (a Sunday) and 24 September (a Tuesday) are in different weeks. The second expression returns 0 because when start_of_week is 'sunday' then 22 September (a Sunday) and 24 September (a Tuesday) are in the same week.


            Date Functions



            Please mark correct and helpful if it works for you




            1 of 1 people found this helpful
            • 3. Re: Difference between dates
              Naveen B

              Hi Venkat,


              Datediff('day',[Start Date],[End date]) will give the difference of days b/w 2 dates



              Replace the datepart with anything in the below as per your requirement



              Hope this helps


              Plz mark this answer as correct or helpful to close the meeting





              • 4. Re: Difference between dates
                meenu choudhary



                You can use DATEDIFF function to achieve this :



                Please refer below link for details on DATE functions:


                Date Functions

                1 of 1 people found this helpful