days_ago

Returns the date that's a specified number of days 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

days_ago(start_date, number_of_days)

Arguments

Argument Required? Description
start_date Required The Date or Date & Time 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_days Required An integer that specifies the number of days ahead or behind to find the date for. Positive values count days in the past, and negative values count days in the future.

Example

Return the date that's 14 days before a deal's close date.

=days_ago(CloseDate, 14)

Return the date that's 14 days after a deal's close date.

DaysAgo = days_ago(CloseDate, -14)

Return the date 10 days after the start of the statement period.

=days_ago(statement_period.start_date, 10)

Return the last day of the previous statement period, or done day before the current statement period.

=days_ago(statement_period.start_date, 1)

Return the date 30 days ago from a text-formatted date.

=days_ago(date("2024-03-31"), 30)

See Also