1 Reply Latest reply on Jul 19, 2017 1:36 PM by Keith Troutt

    Using TODAY() in a DateDiff function

    Kiley Bijlani

      Hi,

      I am trying to find the length of an engagement (in days), I have start and end date fields, however some of the end dates are null because the engagement is ongoing.  In the case of a null end date, I want Tableau to calculate the engagement length using todays date. Although I have no trouble getting the length of engagement for records with a start and end date, I keep getting "null" for the records with no end date.

      I have tried creating a separate field called "current date" using TODAY() and NOW() without success.  Does anyone have an idea of how to resolve this?

       

      IF ISNULL([End Date Episode])

      THEN DATEDIFF('day',[Start Date Episode],[Current date])

      ELSE[End Date Episode]-[Start Date Episode]

      END

       

      Thanks!

      Kiley