# MV_MEDIAN_ABSOLUTE_DEVIATION

The MV_MEDIAN_ABSOLUTE_DEVIATION function converts a multivalued field into a single value representing the median absolute deviation. This is calculated as the median of the absolute differences between each value and the median of the entire sample. For a random variable `X`, the median absolute deviation is `median(|median(X) - X|)`. If the field contains an even number of values, the median is computed as the average of the two middle values, and if the values are not floating point numbers, the averages are rounded towards zero.

## Syntax

`MV_MEDIAN_ABSOLUTE_DEVIATION(number)`

### Parameters

#### number

A multivalue expression containing the values for which the median absolute deviation will be calculated.

## Examples

Calculates both the median absolute deviation and the median for the list of values `[0, 2, 5, 6]` and returns them as columns.

```esql
ROW values = [0, 2, 5, 6]
| EVAL median_absolute_deviation = MV_MEDIAN_ABSOLUTE_DEVIATION(values), median = MV_MEDIAN(values)
```
