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

Automatically substract calendar months from a date


I would need to be able to calculate via formula the previous 12 months from a date.

So example date is 4/1/2015

I would need 12 formula fields each being one of the 12 previous months. So formula would return those values using example above

1. 3/1/2015
2. 2/1/2015
3. 1/1/2015
4. 12/1/2014
5. 11/1/2014

Previous month is simple, but i'm hitting difficulties when previous month is also in previous year (month before january 2015)

If maybe someone could help be built a Generic formula that could accomplish that i would appreciate 

P.S my date field will always be 1st of the month, so formula technicall does not need any special calcualtion for the "day"

Try the below formula which will give correcnt pervious month for any date value. As you requested your date is always 1
DATE(IF(MONTH(SLAExpirationDate__c)==1,YEAR(SLAExpirationDate__c)-1,YEAR(SLAExpirationDate__c)),IF(MONTH(SLAExpirationDate__c)==1,12,MONTH(SLAExpirationDate__c)-1),1 )
Hi Karanraj,

Thank you very much for your answer, 
I actually had found a very similar formula, but my problem is how to adjust it for 2 months back and 3 month... (i need to do 1 formula field for each of the previous 12 months)

Could you maybe give same formula for let's say 6 and/or 12 months back . Based on that , i could see differences and hopefully build other formula for other months missing

Thank you