You are here:
months_ago
Returns the date that's a specified number of months before another date in Salesforce Spiff.
Required Editions
| Available in: both Salesforce Classic (not available in all orgs) and Lightning Experience |
| Available in: Enterprise, Unlimited, and Developer Editions |
| Available for an additional cost in: Professional Edition with Web Services API Enabled |
Syntax
months_ago(start_date, number_of_months)Arguments
| Argument | Required? | Description |
|---|---|---|
| start_date | Required | The date value to evaluate. This argument supports any date functions. To specify a date as a string in YYYY-MM-DD format, use the date() function and enclose the string in double quotes. |
| number_of_months | Required | An integer that specifies the number of months ahead or behind to find the date for. Positive values count months in the past, and negative values count months in the future. |
Considerations
To return the last day of the previous month, use the days_ago() function instead.
Example
Return the date that's three months before the statement period.
=months_ago(statement_period.start_date, 3)Return the date that's three months after the statement period.
=months_ago(statement_period.start_date, -3)Return the date at the beginning of the previous quarter.
=months_ago(beginning_of_quarter(statement_period.start_date), 3)Return the date at the end of the previous quarter.
=months_ago(end_of_quarter(statement_period.start_date), 3)Return the start date three quarters ago. For the February statement period, the start date three quarters ago was April 1 of the previous year.
=months_ago(beginning_of_quarter(statement_period.start_date), 9)See Also
Did this article solve your issue?
Let us know so we can improve!

