function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
damo2929damo2929 

Forumla data type conversion issue

I am trying to write a formula that check the current stage and adds the number of days better two dates to another int number.

 

here is my formual what am trying to do

 

IF( ISPICKVAL( StageName , '0 Identify') ,  ROUND((NOW() - DQ_Days_Since_Stage_Change__c) +DQ_Duration_Stage_0__c  , 0),  DQ_Duration_Stage_0__c )

 

but keep getting the following error Error: Incorrect parameter for function 'ROUND()'. Expected Number, received DateTime

any ides of how to fix this as all the examples use this approch and work.

BA_AdminBA_Admin

when you created this formula field select the number instead of date time, this should resolve the issue

SwarnasankhaSwarnasankha

The expression 'NOW() - DQ_Days_Since_Stage_Change__c' will return a Date/Time value and will not return a number value which is why you are getting the error message because the ROUND() function takes a number as a parameter.

 

Could you please elaborate the requirement - I cannot understand the part "adds the number of days better two dates to another int number"

damo2929damo2929
Basically I have some fields that are logging the number of days in each stage that an opportunity has been in. what am wanting to do is also is work out how long the opportunity has been in the current stage then add the historical value for how long it's been at the same stage to get the total time it's been where it is. our stages can go back as well as forwards so this is whats causing the requirement for me to add the historical value the historical value is populated from the opp history table by a trigger and are stored as integers representing the number of days. am needing to work out the number of days the opportunity has been at the stage returning an integer value. hence ROUND((NOW() - DQ_Days_Since_Stage_Change__c,0) this appears to work on it's own until I try to add the historical value.