

# Aggregate functions
<a name="recipe-actions.functions.aggregate"></a>

Following, find reference topics for aggregate functions that work with recipe actions.

**Topics**
+ [ANY](recipe-actions.functions.ANY.md)
+ [AVERAGE](recipe-actions.functions.AVERAGE.md)
+ [COUNT](recipe-actions.functions.COUNT.md)
+ [COUNT\$1DISTINCT](recipe-actions.functions.COUNT_DISTINCT.md)
+ [KTH\$1LARGEST](recipe-actions.functions.KTH_LARGEST.md)
+ [KTH\$1LARGEST\$1UNIQUE](recipe-actions.functions.KTH_LARGEST_UNIQUE.md)
+ [MAX](recipe-actions.functions.MAX.md)
+ [MEDIAN](recipe-actions.functions.MEDIAN.md)
+ [MIN](recipe-actions.functions.MIN.md)
+ [MODE](recipe-actions.functions.MODE.md)
+ [STANDARD\$1DEVIATION](recipe-actions.functions.STDDEV.md)
+ [SUM](recipe-actions.functions.SUM.md)
+ [VARIANCE](recipe-actions.functions.VAR.md)

# ANY
<a name="recipe-actions.functions.ANY"></a>

 Returns any values from the selected source columns in a new column. Empty and null values are ignored.

**Parameters**
+ `sourceColumns` – A JSON-encoded string representing a list of existing columns.
+ `targetColumn` – A name for the newly created column.

**Example**  
  

```
{
    "RecipeAction": {
        "Operation": "ANY",
        "Parameters": {
            "sourceColumns": "[\"age\",\"last_name\"]",
            "targetColumn": "ANY Column 1"
        }
    }
}
```

# AVERAGE
<a name="recipe-actions.functions.AVERAGE"></a>

 Calculates the average of the values in the source columns and returns the result in a new column. Any non-number is ignored.

**Parameters**
+ `sourceColumns` – A JSON-encoded string representing a list of existing columns.
+ `targetColumn` – A name for the newly created column.

**Example**  
  

```
{
    "RecipeAction": {
        "Operation": "AVERAGE",
        "Parameters": {
            "sourceColumns": "[\"age\",\"weight_kg\",\"height_cm\"]",
            "targetColumn": "AVERAGE Column 1"
        }
    }
}
```

# COUNT
<a name="recipe-actions.functions.COUNT"></a>

 Returns the number of values from the selected source columns in a new column. Empty and null values are ignored.

**Parameters**
+ `sourceColumns` – A JSON-encoded string representing a list of existing columns.
+ `targetColumn` – A name for the newly created column.

**Example**  
  

```
{
    "RecipeAction": {
        "Operation": "COUNT",
        "Parameters": {
            "sourceColumns": "[\"ANY Column 1\",\"birth_date\",\"last_name\"]",
            "targetColumn": "COUNT Column 1"
        }
    }
}
```

# COUNT\$1DISTINCT
<a name="recipe-actions.functions.COUNT_DISTINCT"></a>

 Returns the total number of distinct values from the selected source columns in a new column. Empty and null values are ignored.

**Parameters**
+ `sourceColumns` – A JSON-encoded string representing a list of existing columns.
+ `targetColumn` – A name for the newly created column.

**Example**  
  

```
{
    "RecipeAction": {
        "Operation": "COUNT_DISTINCT",
        "Parameters": {
            "sourceColumns": "[\"long_name\",\"weight_kg\"]",
            "targetColumn": "COUNT_DISTINCT Column 1"
        }
    }
}
```

# KTH\$1LARGEST
<a name="recipe-actions.functions.KTH_LARGEST"></a>

 Returns the *k*th largest number from the selected source columns in a new column. 

**Parameters**
+ `sourceColumns` – A JSON-encoded string representing a list of existing columns.
+ `targetColumn` – A name for the newly created column.
+ `value` – A number representing *k*.

**Example**  
  

```
{
    "RecipeAction": {
        "Operation": "KTH_LARGEST",
        "Parameters": {
            "sourceColumns": "[\"height_cm\",\"weight_kg\",\"age\"]",
            "targetColumn": "KTH_LARGEST Column 1",
            "value": "2"
        }
    }
}
```

# KTH\$1LARGEST\$1UNIQUE
<a name="recipe-actions.functions.KTH_LARGEST_UNIQUE"></a>

 Returns the *k*th largest unique number from the selected source columns in a new column.

**Parameters**
+ `sourceColumns` – A JSON-encoded string representing a list of existing columns.
+ `targetColumn` – A name for the newly created column.

  `value` – A number representing *k*.

**Example**  
  

```
{
    "RecipeAction": {
        "Operation": "KTH_LARGEST_UNIQUE",
        "Parameters": {
            "sourceColumns": "[\"age\",\"height_cm\",\"weight_kg\"]",
            "targetColumn": "KTH_LARGEST_UNIQUE Column 1",
            "value": "3"
        }
    }
}
```

# MAX
<a name="recipe-actions.functions.MAX"></a>

 Returns the maximum numerical value from the selected source columns in a new column. Any non-number is ignored.

**Parameters**
+ `sourceColumns` – A JSON-encoded string representing a list of existing columns.
+ `targetColumn` – A name for the newly created column.

**Example**  
  

```
{
    "RecipeAction": {
        "Operation": "MAX",
        "Parameters": {
            "sourceColumns": "[\"age\",\"height_cm\",\"weight_kg\"]",
            "targetColumn": "MAX Column 1"
        }
    }
}
```

# MEDIAN
<a name="recipe-actions.functions.MEDIAN"></a>

 Returns the median, the middle number of a sorted group of numbers, from the selected source columns in a new column. Any non-number is ignored.

**Parameters**
+ `sourceColumns` – A JSON-encoded string representing a list of existing columns.
+ `targetColumn` – A name for the newly created column.

**Example**  
  

```
{
    "RecipeAction": {
        "Operation": "MEDIAN",
        "Parameters": {
            "sourceColumns": "[\"age\",\"years_in_service\"]",
            "targetColumn": "MEDIAN Column 1"
        }
    }
}
```

# MIN
<a name="recipe-actions.functions.MIN"></a>

 Returns the minimum value from the selected source columns in a new column. Any non-number is ignored.

**Parameters**
+ `sourceColumns` – A JSON-encoded string representing a list of existing columns.
+ `targetColumn` – A name for the newly created column.

**Example**  
  

```
{
    "RecipeAction": {
        "Operation": "MIN",
        "Parameters": {
            "sourceColumns": "[\"age\",\"height_cm\",\"weight_kg\"]",
            "targetColumn": "MIN Column 1"
        }
    }
}
```

# MODE
<a name="recipe-actions.functions.MODE"></a>

Returns the mode, the number that appears most often, from the selected source columns in a new column. Any non-number is ignored. For multiple modes, the mode is calculated with the modal function.

**Parameters**
+ `sourceColumns` – A JSON-encoded string representing a list of existing columns.
+ `targetColumn` – A name for the newly created column.

**Example**  
  

```
{
    "RecipeAction": {
        "Operation": "MODE",
        "Parameters": {
            "modeType": "MINIMUM",
            "sourceColumns": "[\"years_in_service\",\"age\"]",
            "targetColumn": "MODE Column 1"
        }
    }
}
```

# STANDARD\$1DEVIATION
<a name="recipe-actions.functions.STDDEV"></a>

 Returns the standard deviation from the selected source columns in a new column. 

**Parameters**
+ `sourceColumns` – A JSON-encoded string representing a list of existing columns.
+ `targetColumn` – A name for the newly created column.

**Example**  
  

```
{
    "RecipeAction": {
        "Operation": "STANDARD_DEVIATION",
        "Parameters": {
            "sourceColumns": "[\"years_in_sservice\",\"age\"]",
            "targetColumn": "STANDARD_DEVIATION Column 1"
        }
    }
}
```

# SUM
<a name="recipe-actions.functions.SUM"></a>

Returns the sum of the values from the selected source columns in a new column. Any non-number is treated as 0.

**Parameters**
+ `sourceColumns` – A JSON-encoded string representing a list of existing columns.
+ `targetColumn` – A name for the newly created column.

**Example**  
  

```
{
    "RecipeAction": {
        "Operation": "SUM",
        "Parameters": {
            "sourceColumns": "[\"age\",\"years_in_service\"]",
            "targetColumn": "SUM Column 1"
        }
    }
}
```

# VARIANCE
<a name="recipe-actions.functions.VAR"></a>

 Returns the variance from the selected source columns in a new column. Variance is defined as `Var(X) = [Sum ((X – mean(X))^2)]/Count(X)`.

**Parameters**
+ `sourceColumns` – A JSON-encoded string representing a list of existing columns.
+ `targetColumn` – A name for the newly created column.

**Example**  
  

```
{
    "RecipeAction": {
        "Operation": "VARIANCE",
        "Parameters": {
            "sourceColumns": "[\"age\",\"years_in_service\"]",
            "targetColumn": "VARIANCE Column 1"
        }
    }
}
```