Built-in Functions → max

max() is an aggregation function that returns the maximum value in a column.

Signature

max(double expr, [groupBy(...)]))
  • expr : expression returning double
  • groupBy : optional grouping function that specifies which group of data to operate over
Note

If you use the groupBy function, you must include all the leading grouping dimensions in the Insight from the top-down to the level-based measure you want to evaluate. For more information, refer to Aggregation with a Level Based Measure.

Returns

double or as many doubles as there are groups if groupBy is used.

Examples

  • Find the maximum number sold.
max(Sales_Acme.Sales.AMOUNT_SOLD)
  • Find the maximum number sold, categorized by city.
max(Sales_Acme.Sales.AMOUNT_SOLD, groupBy(Sales_Acme.Sales.CITY))