# Maximum macro

Learn how to find the largest number in a collection.

This macro returns the maximum value in a [collection](/reference/cql/data-types/core/collection).

The maximum is the largest of all the numbers in the collection. For example, the maximum of the numbers 2, 3, 4, 7, and 9 is 9.

Since an empty collection has no maximum, trying to get the maximum of an empty collection results in an error. So be sure to provide a [default value](/reference/cql/expressions/operations/other/fallback) in cases where the collection might be empty.

## Syntax

This macro has the following syntax:

```cql
maximum of /*<collection>*/
```

Alternatively, you can use the abbreviated form:

```cql
max of /*<collection>*/
```

You can also prefix the macro with a definite article for readability:

```cql
the maximum of /*<collection>*/
```

## Parameters

These are the supported parameters:

- `collection`: `collection`

  A non-empty collection of numbers from which you want to find the maximum. Elements are automatically converted to numbers if necessary.

## Examples

Here is an example of how to get the maximum value of a collection of numbers:

```cql
maximum of [1.5, 2.5, "3"] // 3
```

In cases where the collection might be empty, you can provide a default value:

```cql
maximum of /*<collection>*/ or else null
```
