Loading
Sales Performance Management
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          months_to

          months_to

          Returns the number of months between two dates or times in Salesforce Spiff. If the return value is a negative number, the second date occurred before the first date.

          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_to(start_date_or_time, end_date_or_time)

          Arguments

          Argument Required? Description
          start_date_or_time Required The Date or Date & Time value that's the lower bound of the range. This argument supports any date functions.
          end_date_or_time Required The Date or Date & Time value that's the upper bound of the range. This argument supports any date functions.

          Example

          Create a custom field on the account object that represents the contract start date, and return the number of months between the contract start date and the deal's close date.

          =months_to(DealToAccount.ContractStartDate__c, CloseDate)

          Your company awards a $100 bonus to a rep whose go-live date occurs within two months of closing the deal. Return the months between the go-live date and close date. Wrap the function with an if statement that determines whether the result is less than two months and, if so, rewards $100 to the rep for each deal.

          =if(months_to(CloseDate, GoLiveDate) <= 2, 100, 0)

          Return the number of a specific month within a quarter, such as 3 for March.

          =months_to(beginning_of_quarter(statement_period.start_date), statement_period.start_date) + 1
           
          Loading
          Salesforce Help | Article