Max() finds the highest numeric value of the aggregated data in the expression, as defined by a group by clause. By specifying a rank n, the nth highest value can be found.
Return data type: numeric
|expr Expression||The expression or field containing the data to be measured.|
The default value of rank is 1, which corresponds to the highest value. By specifying rank as 2, the second highest value is returned. If rank is 3, the third highest value is returned, and so on.
Examples and results:
Add the example script to your app and run it. Then add, at least, the fields listed in the results column to a sheet in our app to see the result.
To get the same look as in the result column below, in the properties panel, under Sorting, switch from Auto to Custom, then deselect numerical and alphabetical sorting.
LOAD * inline [
] (delimiter is '|');
LOAD Customer, Max(UnitSales) as MyMax Resident Temp Group By Customer;
Given that the Temp table is loaded as in the previous example:
LOAD Customer, Max(UnitSales,2) as MyMaxRank2 Resident Temp Group By Customer;