# Aggregation functions

Aggregation functions take between 2 and 255 parameters, and result in a single value.

## Min

Minimum of a list

Expression

```apteco
Min([Value1], [Value2], [Value3])
```

Example:

Expression

```apteco
Min(2.3, 3.4, 5.2, 2.2)
```

## Max

Maximum of a list

Expression

```apteco
Max([Value1], [Value2], [Value3])
```

Example:

Expression

```apteco
Max(2.3, 3.4, 5.2, 2.2)
```

## Mean

Mean average of a list

Expression

```apteco
Mean([Value1], [Value2], [Value3])
```

Example:

Expression

```apteco
Mean(2.3, 3.4, 5.2, 2.2)
```

## Median

Median average of a list

Expression

```apteco
Median([Value1], [Value2], [Value3])
```

Example:

Expression

```apteco
Median(2.3, 3.4, 5.2, 2.2)
```

The median is the “middle” entry when the numbers are sorted in order. If there is an even number of entries the median is the mean of the 2 middle entries.

## Mode

The Modal average of a list

Expression

```apteco
Mode( 1, 2, 3, 4)
```

For example:

Expression

```apteco
Mode(1,2,3,2,4,2,3)
```

This expression returns 2.

The mode is undefined if there is a tie but by convention we return the first tied candidate.

For example:

Expression

```apteco
Mode(1,7,3,7,4,7,3,1,3)
```

This expression returns 3.

## RankCoeff

Returns a value between -1 and 1 as a result of calculating a series of values (number or date) using the Spearman Rank Coefficient

For example:

Expression

```apteco
RankCoeff(10,20,30)
```

This expression will return a value of 1.

Expression

```apteco
RankCoeff(9,7,8)
```

This expression will return a value of -0.5.

## RankSequence

Returns a value based upon the sequence of a series of numbers or dates

If all values are equal then a value of 3 is returned

Expression

```apteco
RankSequence(15,15,15)
```

If the values are increasing with no ties then a value of 2 is returned

Expression

```apteco
RankSequence(10,20,30)
```

If the values are increasing with ties then a value of 1 is returned

Expression

```apteco
RankSequence(10,20,20)
```

If the values have no order then a value of 0 is returned

Expression

```apteco
RankSequence(73,4,56)
```

If the values are decreasing with ties then a value of -1 is returned

Expression

```apteco
RankSequence(50,40,40)
```

If the values are decreasing with no ties then a value of -2 is returned

Expression

```apteco
RankSequence(50,40,30)
```

## StdDev

Standard deviation average of a list

Expression

```apteco
StdDev([Value1], [Value2], [Value3])
```

Example:

Expression

```apteco
StdDev(2.3, 3.4, 5.2, 2.2)
```

## Sum

Sum of values

Expression

```apteco
Sum([Value1],[Value2],[Value3])
```

For example:

Expression

```apteco
Sum(25, 65, 10)
```

This expression returns 100.
