[SalesForce] Formula to get days between dates

Need to create a formula to calculate number of days between two date fields across objects.

I have created a formula field to calculate the number of days between two date fields:

Date Type = formula
Result = Number 
dummy__r.dummy_date__c - DATEVALUE( CreatedDate )

But this formula is not providing a value.

Best Answer

Formula = (FieldValue1) - (FieldValue2).

You have to ensure that the FieldValue1 and FieldValue2 are of same type i.e.

  1. Both should be DateTime or
  2. Both should be Date or
  3. Both should be number.