Use the min_of function in APL to determine the minimum value among two or more scalar values. The function returns the smallest of its arguments, making it especially useful when you want to compare metrics, constants, or calculated expressions in queries.

You typically use min_of when you want to:

  • Compare numeric or time-based values across multiple fields or constants.
  • Apply conditional logic in summarization or filtering steps.
  • Normalize or bound values when computing metrics.

Unlike aggregation functions such as min(), which work across rows in a group, min_of operates on values within a single row or context.

For users of other query languages

If you come from other query languages, this section explains how to adjust your existing queries to achieve the same results in APL.

Usage

Syntax

min_of(Expr1, Expr2, ..., ExprN)

Parameters

The function takes a comma-separated list of expressions to compare. All values must be of the same type.

Returns

The function returns the smallest of the provided values. The type of the return value matches the type of the input arguments.

Use case example

You have two data points for the size of HTTP responses: header size and body size. You want to find the minimum of these two values for each event.

Query

['sample-http-logs']
| extend min_size = min_of(resp_header_size_bytes, resp_body_size_bytes)
| project _time, id, resp_header_size_bytes, resp_body_size_bytes, min_size

Run in Playground

Output

_timeidresp_header_size_bytesresp_body_size_bytesmin_size
May 15, 11:31:05739b0433-39aa-4891-a5e0-3bde3cb4038641 B3,410 B41
May 15, 11:31:053016c439-ea30-454b-858b-06f0a66f44b953 B5,333 B53
May 15, 11:31:05b26b0a5c-bc73-4693-86ad-be9e0cc767d660 B2,936 B60
May 15, 11:31:058d939423-26ae-43f7-9927-13499e7cc7d360 B2,896 B60
May 15, 11:31:0510c37b1a-5639-4c99-a232-c8295e3ce66463 B4,871 B63
May 15, 11:31:054aa1821a-6906-4ede-9417-3097efb76b8978 B1,729 B78
May 15, 11:31:056325de66-0033-4133-b2f3-99fa70f8c9c096 B4,232 B96