# Aggregate

### Any value

Returns any value from the input or NULL if there are zero input rows –> [learn more](https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#any_value)

```sql
ANY_VALUE(@variable)
```

#### Return type

dynamic (input-dependent)

#### Parameters

| Name        | Type                                                                                                                       | Allowed values                                                                           | Required | Placeholder (in UI) |
| ----------- | -------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -------- | ------------------- |
| `@variable` | [variable](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#variable) | any [Redivis type](https://docs.redivis.com/reference/datasets/variables#variable-types) | true     | -                   |

### Average

Returns the average of all non-null values –> [learn more](https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#avg)

```sql
AVG(@variable)
```

#### Return type

float

#### Parameters

| Name        | Type                                                                                                                       | Allowed values                                                                                                                                     | Required | Placeholder (in UI) |
| ----------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------------------- |
| `@variable` | [variable](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#variable) | any [integer](https://docs.redivis.com/reference/datasets/variables#integer), [float](https://docs.redivis.com/reference/datasets/variables#float) | true     | -                   |

### Count

Returns the count of all non-null values –> [learn more](https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#count)

```sql
COUNT([@distinct ]@variable)
```

#### Return type

integer

#### Parameters

| Name        | Type                                                                                                                       | Allowed values                                                                           | Required | Placeholder (in UI) |
| ----------- | -------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -------- | ------------------- |
| `@variable` | [variable](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#variable) | any [Redivis type](https://docs.redivis.com/reference/datasets/variables#variable-types) | false    | *(\*)*              |
| `@distinct` | [boolean](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#boolean)   | any [boolean](https://docs.redivis.com/reference/datasets/variables#boolean)             | true     | -                   |

### Logical and

Returns the logical AND of all non-NULL expressions –> [learn more](https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#logical_and)

```sql
LOGICAL_AND(@variable)
```

#### Return type

boolean

#### Parameters

| Name        | Type                                                                                                                       | Allowed values                                                               | Required | Placeholder (in UI) |
| ----------- | -------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -------- | ------------------- |
| `@variable` | [variable](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#variable) | any [boolean](https://docs.redivis.com/reference/datasets/variables#boolean) | true     | -                   |

### Logical or

Returns the logical OR of all non-NULL expressions –> [learn more](https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#logical_or)

```sql
LOGICAL_OR(@variable)
```

#### Return type

boolean

#### Parameters

| Name        | Type                                                                                                                       | Allowed values                                                               | Required | Placeholder (in UI) |
| ----------- | -------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -------- | ------------------- |
| `@variable` | [variable](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#variable) | any [boolean](https://docs.redivis.com/reference/datasets/variables#boolean) | true     | -                   |

### Max

Returns the maximum value of all non-null inputs –> [learn more](https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#max)

```sql
MAX(@variable)
```

#### Return type

dynamic (input-dependent)

#### Parameters

| Name        | Type                                                                                                                       | Allowed values                                                                           | Required | Placeholder (in UI) |
| ----------- | -------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -------- | ------------------- |
| `@variable` | [variable](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#variable) | any [Redivis type](https://docs.redivis.com/reference/datasets/variables#variable-types) | true     | -                   |

### Min

Returns the minimum value of all non-null inputs –> [learn more](https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#min)

```sql
MIN(@variable)
```

#### Return type

dynamic (input-dependent)

#### Parameters

| Name        | Type                                                                                                                       | Allowed values                                                                           | Required | Placeholder (in UI) |
| ----------- | -------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -------- | ------------------- |
| `@variable` | [variable](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#variable) | any [Redivis type](https://docs.redivis.com/reference/datasets/variables#variable-types) | true     | -                   |

### String aggregate

Returns a string obtained by concatenating all non-null values –> [learn more](https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#string_agg)

```sql
STRING_AGG([@distinct ]@variable[, @delimiter][ LIMIT @limit])
```

#### Return type

string

#### Parameters

| Name         | Type                                                                                                                       | Allowed values                                                                           | Required | Placeholder (in UI) |
| ------------ | -------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -------- | ------------------- |
| `@variable`  | [variable](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#variable) | any [string](https://docs.redivis.com/reference/datasets/variables#string)               | true     | -                   |
| `@delimiter` | [literal](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#literal)   | any [Redivis type](https://docs.redivis.com/reference/datasets/variables#variable-types) | false    | *(",")*             |
| `@distinct`  | [boolean](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#boolean)   | any [boolean](https://docs.redivis.com/reference/datasets/variables#boolean)             | true     | -                   |
| `@limit`     | [literal](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#literal)   | any [Redivis type](https://docs.redivis.com/reference/datasets/variables#variable-types) | false    | -                   |

### Sum

Returns the sum of all values, ignoring nulls –> [learn more](https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#sum)

```sql
SUM(@variable)
```

#### Return type

dynamic (input-dependent)

#### Parameters

| Name        | Type                                                                                                                       | Allowed values                                                                                                                                     | Required | Placeholder (in UI) |
| ----------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------------------- |
| `@variable` | [variable](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#variable) | any [integer](https://docs.redivis.com/reference/datasets/variables#integer), [float](https://docs.redivis.com/reference/datasets/variables#float) | true     | -                   |
