2 Replies Latest reply on Sep 18, 2017 1:55 PM by Justin Larson

# Looking for Help with a Date Difference Calculation

Hello Everyone,

I'm looking for some help or insight on how I can create a calculation that would calculate the number of days between a "Target Date" and a "Last Completed Date". I'm wanting to display the number of days between both. For example:

• "Target Date" is the planned date of when action should be taken
• "Last Completed Date" is the actual date where the action was complete

I was successful calculating this if the "Last Completed Date" is a null value, but for some reason it is not working if there is a tangible date for "Last Completed Date":

IF ([Status of Problem Record]="Cancelled Record") THEN 0

ELSEIF ([Status of Problem Record]="Completed Record")THEN ([Last Completed Date]-[Submit Date])

ELSE(NOW()-[Target Date])

END

I'm guessing it has something to do with ([Status of Problem Record]="Completed Record"), and if so I'm having troubles writing it so it neglects the "Cancelled Record" and includes all other values for [Status of Problem Record]

Thanks in advance for any help for this ongoing newbie

Much Appreciated,

Alex

• ###### 1. Re: Looking for Help with a Date Difference Calculation

Ugh, I just figured out my mistake. I did not edit [Submit Date] to reflect as [Target Date]. Once I corrected that, everything worked as expected:

IF ([Status of Problem Record]="Cancelled Record") THEN 0

ELSEIF ([Status of Problem Record]="Completed Record")THEN ([Last Completed Date]-[Target Date])

ELSE(NOW()-[Target Date])

END

Sometimes you just need to "talk" it out so thanks to anyone that listed in the original post.

Thanks,

Alex

• ###### 2. Re: Looking for Help with a Date Difference Calculation

Happens to the best of us.