Description
Determines the Nth most frequent value in a given field, either for the entire report or for each instance of the (condFld) group.
Overloads
NthMostFrequent (N, fld, condFld)
NthMostFrequent (N, fld, condFld, cond)
Arguments
N is any integer from 1 to 100 (inclusive).
fld is any valid database or formula field that can be evaluated by the function.
condFld is a field used to group the values in fld by.
cond is a String indicating the type of grouping for condFld. You only specify this argument when condFld is a Date, Time, DateTime or Boolean field. For more information on the valid strings for this argument, see
Conditions for summary functions.
Action
Determines the Nth most frequent value in a given field, either for the entire report or for each instance of the (condFld) group. If no values in the field appear more than once, the function will return the minimum value, by default.
Typical Uses
You can use this function to spotlight exceptionally high or exceptionally low values in a particular field.
Examples
NthMostFrequent(1, {Customer.LAST YEAR'S SALES})
Returns $29087, where the value of $29087 appears most frequently in the Last Year's Sales field.
NthMostFrequent(2, {Customer.LAST YEAR'S SALES})
Returns $34700, where $34700 is the value that appears with the second highest frequency in the Last Year's Sales field.
NthMostFrequent(1, {Customer.LAST YEAR'S SALES}, {Customer.REGION})
Returns $48000 for one instance of the Customer.Region group, where $48000 is the value that appears most frequently in that group; returns $34000 for another instance of the group, where $34000 is the most frequent value for that occurrence of the group; and returns $9000 for a third instance of the group, where none of the values in this occurrence of the group are repeated, and $9000 is the lowest value.
Comments
When more than one value appears with the same frequency, the least value is considered the most frequent. For example, if
NthMostFrequent(1, {Customer.LAST YEAR'S SALES})
returns a value of $29087, and a value greater than $29087 (for example, $35000) appears with the same frequency, NthMostFrequent with N = 1 will still return $29087, since $29087 is the lesser value.
Using this function in a formula forces the formula to be evaluated at print time.
For more information on evaluation time considerations, see
Evaluation Time.