### Aggregates

The aggregate block allows you to do a calculation on a set of number-value results from a search question. It requires you to choose the aggregate function you want, then it requires you to choose the variable that will hold the number values you are interested in, and then it requires you to do a search that will find the relevant variables.

For example, let’s say you have three people and you want to find out who is the youngest. You might encode that as follows:

The block will return a Number value, as is suggested by its colour, and it can be used anywhere a number can be used, such as in a mathematical operation, or a comparison.

## Aggregate Functions

### Minimum

Minimum will provide you with the smallest number in the set of results. If the set of results is 1,3,5,6,6,7,8; the answer will be 1.

### Maximum

Maximum will provide you with the largest number in the set of results. If the set of results is 1,3,5,6,6,7,8; the answer will be 8.

### Count

Count will provide you with the size of the set of results. If the set of results is 1,3,5,6,6,7,8; the answer will be 7.

### Distinct Count

Distinct Count will provide you with the size of the set of results excluding duplicates. If the set of results is 1,3,5,6,6,7,8; the answer will be 6.

### Average

Average will provide you with the mean of the set of results. If the set of results is 1,3,5,6,6,7,8; the answer will be 5.142….

### Distinct Average

Distinct Average will provide you with the mean of the set of results excluding duplicates. If the set of results is 1,3,5,6,6,7,8; the answer will be 5.

### Sum

Sum will provide you with the sum of the set of results. If the set of results is 1,3,5,6,6,7,8; the answer will be 36.

### Distinct Sum

Distinct Sum will provide you with the sum of the set of results excluding duplicates. If the set of results is 1,3,5,6,6,7,8; the answer will be 30.

## No Comments