# MV_PERCENTILE

This function converts a multivalued field into a single-valued field. The single-valued field it produces contains the value at which a specified percentage of observed values occur.

## Syntax

`MV_PERCENTILE(number, percentile)`

### Parameters

#### number

This refers to a multivalue expression.

#### percentile

Value for the percentile to calculate. The value should range from 0 and 100. Values outside this range return null.

## Examples

Consider an instance where you want to calculate the 50th percentile (or median) of a set of numbers - `[5, 5, 10, 12, 5000]`. This can be done using the following statement.

```esql
ROW values = [5, 5, 10, 12, 5000]
| EVAL p50 = MV_PERCENTILE(values, 50), median = MV_MEDIAN(values)
```