Gregg Arnold 2 Posted October 21, 2020 Share Posted October 21, 2020 I have two colums, one for failure date and one for install date. I can perform the basic function of subtracting one from the other to get run time, however, when there is no failure date input I want to know the current number of days running but if there is a failure date, I want to show that calculation. The expression I am trying to use is: case when [Failure Date] Is Null, DateDiff('Day',[install Date],DateTimeNow()) ELSE [Failure Date] - [install Date] END I have also tried: If([Failure Date] Is Null(), DateDiff("Day", [install Date], DateTimeNow()), DateDiff("Day",[install Date],[Failure Date])) Link to comment Share on other sites More sharing options...
Gregg Arnold 2 Posted October 21, 2020 Author Share Posted October 21, 2020 I figured it out, took me a few tries but it wors perfectly. Here is my solution in case anyone else has this issue. case WHEN [Failure Date] Is Null THEN DateDiff(DateTimeNow(),[install Date]) WHEN [Failure Date] Is Not Null THEN DateDiff([Failure Date],[install Date]) END Link to comment Share on other sites More sharing options...
Fabian Duerr Posted October 21, 2020 Share Posted October 21, 2020 You just missed the DateDiff function in the else statement of your 1st try... ;) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now