Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.
Dan Gorman edited this page Nov 29, 2018 · 2 revisions

The MAX Function

Function Group: Statistical

MAX returns the largest value in a numeric dataset.

Syntax

MAX(arg1, [arg2...])

  • arg1 can be a number, string or an array of numbers or strings (or anything that can be coerced into being a number)
  • arg2 is optional, and has the same restrictions as arg1
  • MAX also takes an arbitrary number of additional arguments

Uses

Let's say we're given a response with some service station information that looks like this:

{  
   "data":{
      "local_service_ratings": {   
      "cheapest": 4,
      "nearest": 6,
      "regional": [4, 5, 6, 8, 9]
     }
   }
}

If we want to find highest rated service stations, we can just use MAX:

MAX(data.local_service_ratings.cheapest, data.local_service_ratings.nearest)

This will return 6.

Other Examples

MAX can also take arrays as arguments.

MAX(data.local_service_ratings.cheapest, data.local_service_ratings.nearest, data.local_service_ratings.regional) => 9

Clone this wiki locally