Returning the First or Last Date from a Data Filter in Salesforce Spiff
Returning the first or last date in a period is helpful when filtering data in Salesforce Spiff. For example, maybe you want to know the date of the first deal closed in a period or the last deal in the quarter.
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
Consider a datasheet that uses the ClosedInPeriod data filter, which returns all closed deals for a specific rep in a specific time period.
To return the date of the first deal in the period, add a formula.
The sort() function sorts datasheet rows by CloseDate in ascending order.
The transform_list() function transforms the sorted rows into an array of CloseDate values.
The choose() function selects the first item in the array.
To return the date of the last deal in the period instead, sort datasheet rows by CloseDate in descending order by adding -1 as an optional third argument for the sort() function.
We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required Cookies
Always Active
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional Cookies
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising Cookies
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.