Min, Max, First, Last are all commonly used functions in Results reports. The two pairs seem as though they perform similar actions at first glance, such as displaying the highest and lowest value for a numeric data object. However, they have different uses depending on the needs of the formula or variable. Continue reading below to learn more about these functions.
Minimum and Maximum
Using Min( ) around a data object shows its lowest value, while using Max( ) shows the highest value. The value considered to be the lowest or highest is determined by the object type:
Text objects will be organized alphabetically
Min( ) will show the value closest to the start of the alphabet; Max( ) will show the value closest to the end
Numeric objects will be organized numerically
Min( ) will show the smallest number; Max( ) will show the largest number
Date objects will be organized by date
Min( ) will show the earliest date; Max( ) will show the latest date
First and Last
These functions can also recognize the difference between text, numbers, and dates. However, First( ) and Last( ) will use the context of the other objects in the report table to determine which is the earliest or most recent value for the data object.
For example, if the object only contains "Yes" or "No" responses, using Max( ) will always return the "Yes" value as it's closer to the end of the alphabet. Last( ), on the other hand, will attempt to find which value is associated with the most recent record response.
In this case, you'll need to include the relevant Creation Date object for the form so the Last( ) function can use its context to accurately determine the most recent record and its response to the "Yes" or "No" field. Otherwise, the function may not return the value you're intending it to.