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 MIN Function

Function Group: Statistical

MIN returns the minimum value in a numeric dataset.

Syntax

MIN(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
  • MIN also takes an arbitrary number of additional arguments

Uses

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

{  
   "data":{  
      "local_service_prices":{  
         "highest_rated":160,
         "nearest":120,
         "regional":[  
            140,
            90,
            115,
            220
         ]
      }
   }
}

If we want to find the smaller of the nearest and highest rated service stations, we can just use MIN:

MIN(data.local_service_prices.highest_rated, data.local_service_prices.nearest)

This would return 120.

Other Examples

MIN can also take arrays as arguments.

MIN(data.local_service_prices.highest_rated, data.local_service_prices.nearest, data.local_service_prices.regional) => 90

Clone this wiki locally