# `max`

## Description

Returns the largest numerical value from the input.

- Can be used in aggregation to compute the maximum value across grouped rows.
- When used with multiple arguments, returns the largest among them.

## Syntax

```dataprime
max(value: number, ...values: number): number
```

## Arguments

| Name      | Type   | Required | Description                                        |
| --------- | ------ | -------- | -------------------------------------------------- |
| value     | number | **true** | The first numerical value to compare               |
| ...values | number | **true** | One or more additional numerical values to compare |

## Example

**Use case: Find the largest latency per path**

Suppose you want to identify which traces in your logs have the highest duration.

### Example data

```json
{ "applicationName": "checkout", "duration": 50174000 },
{ "applicationName": "checkout", "duration": 42000000 },
{ "applicationName": "web-app", "duration": 39151233 },
{ "applicationName": "web-app", "duration": 35000000 },
{ "applicationName": "checkly-browser-check", "duration": 25269000 },
{ "applicationName": "docs", "duration": 17260981 },
{ "applicationName": "notifications", "duration": 8000000 },
{ "applicationName": "search", "duration": 15000000 },
{ "applicationName": "auth-service", "duration": 9000000 },
{ "applicationName": "auth-service", "duration": 7000000 }
```

### Example query

```dataprime
source spans
| top 10 $l.applicationName by max($m.duration)
```

### Example output

| applicationName       | \_max0   |
| --------------------- | -------- |
| checkout              | 50174000 |
| web-app               | 39151233 |
| checkly-browser-check | 25269000 |
| docs                  | 17260981 |
