+ Start a Discussion
Lee_CampbellLee_Campbell 

Calculating the total Close Date change

Hi all,

 

I was wondering if it was possible to calculate the total change in Close Date somehow from the field history. I know I could do it for future opportunities by invoking some kind of workflow that fires upon Opportunity creation, but I'd like to be able to subtract the first Close Date entered for the Opportunity from the current Close Date to give a total Close Date change for historic data (Opportunities created before I thought to create this workflow). Bear in mind, the Close Date may have changed three or four times, so the "previous" or "old" Close Date is of no use -- it needs to be the first one entered for that Opportunity.

 

Ideally, I'd like the answer to be displayed in months, if possible, and by months I mean actual months (i.e. a move from 31/07/12 to 01/09/12 is two months, even though it's only 31 days).

 

Thanks in advance for any help you can give.

Best Answer chosen by Admin (Salesforce Developers) 
SFFSFF

There are several easy ways to approach this. I think the easiest approach would be to set up a new custom field, Original Close Date. Then you can set up a workflow to automatically update this field when it is null and Close Date is null. That will capture the original Close Date value. Then you can easily set up a formula field to calculate the number of days (or months) between the original and final close dates.

 

You could set up some other logic that requires Apex - but why?

 

Good luck!

All Answers

SFFSFF

There are several easy ways to approach this. I think the easiest approach would be to set up a new custom field, Original Close Date. Then you can set up a workflow to automatically update this field when it is null and Close Date is null. That will capture the original Close Date value. Then you can easily set up a formula field to calculate the number of days (or months) between the original and final close dates.

 

You could set up some other logic that requires Apex - but why?

 

Good luck!

This was selected as the best answer
Donna Lutchman 6Donna Lutchman 6
This will only work on new Opps created, no?  This will not update existing Opps with the original close date.