DateTime difference in Salesforce Report Formula

DateTime difference in Salesforce Report Formula

To find the Date Time difference in Salesforce Report Formula, use the DATEVALUE().

Sample Salesforce Report Formula:

IF(
ISNULL(CLOSED_DATE), 
DATEVALUE(NOW()) - DATEVALUE(Case.Completed_Date__c), 
DATEVALUE(CLOSED_DATE) - DATEVALUE(Case.Completed_Date__c)
)

As per the above formula, if the Case is closed, then the Completion Age is found by finding the difference between Case Closed Date and the Case Completed Date. If the Case is not closed, then the Completion Age is found by finding the difference between current Date Time and the Completion Date.

Output:

Leave a Reply