Copy as Markdown[Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fdocs-docusaurus.kinsta.page%2Fdataprime%2Flanguage-reference%2Ffunctions-reference%2Faggregation%2Fmax.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fdocs-docusaurus.kinsta.page%2Fdataprime%2Flanguage-reference%2Ffunctions-reference%2Faggregation%2Fmax.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)

# `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

```
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

```
{ "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

```
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 |
