# Aggregate

Aggregate functions calculate values based on two factors: The input cell, which is usually, but not always a data field, and the report section that the function is located, relative to the input. The location of the function determines which, and how many cell values will be sent to the input. For example, an AggCount function in a Group Footer will count the values in the group, but that same function in a Report Footer will count the values for the entire report.

> Advanced Users - Aggregating for One-to-Many Relationships
> As of version 2016.3.8, aggregate functions have an optional argument that indicates how to count aggregates for one-to-many relationships. This argument indicates whether aggregation should occur at the record level or entity level. Pass True() to force aggregation to occur for every record, regardless of whether or not the record represents a unique instance of the entity that is being aggregated. By default, aggregation occurs only for every unique instance of the entity being aggregated, not for repeat values that occur from a one-to-many data relationship.
> Most users can choose to ignore this option by simply omitting the argument.

Note: Aggregate functions cannot be used in conditional formulas or ExpressView formula columns.

# AggAvg

Description | Returns the average of the values in a group.
Remark | Accepts data fields or cell references. (v2016.3.8+) Optional second argument indicates whether to count: True - records, False - entities (default).
Example | Ex. aggAvg({OrderDetail.Quantity}) - returns the average quantity of sales orders.

###

# AggCount

Description | Returns the number of unique entities in a Data Category.
Remark | The aggCount function uses the Data Category, not the Data Field. For example, the function “aggCount( {Officer.Salary} )” counts the number of Officers. You could replace “Officer.Salary” with any other field in the Officer Data Category and the function would still count the number of officers. (v2016.3.8+) Optional second argument indicates whether to count: True - records, False - entities (default).
Example | Ex. aggCount({Orders.ProductPrice}) - returns the number of sales orders.

###

# AggDistinctCount

Description | Returns the number of unique values in a group.
Remark | Accepts data fields or cell references. (v2016.3.8+) Optional second argument indicates whether to count: True - records, False - entities (default).
Example | Ex. aggDistinctCount({OrderDetail.Quantity}) - returns the number distinct quantities in an order.

###

# AggMax

Description | Returns the maximum value in a group.
Remark | Accepts data fields or cell references. (v2016.3.8+) Optional second argument indicates whether to count: True - records, False - entities (default).
Example | Ex. aggMax({OrderDetail.Discount}) - returns the largest discount.

###

# AggMin

Description | Returns the minimum value in a group.
Remark | Accepts data fields or cell references. (v2016.3.8+) Optional second argument indicates whether to count: True - records, False - entities (default).
Example | Ex. aggMin({OrderDetail.Discount}) - returns the smallest discount.

###

# AggSum

Description | Returns the sum of the values in a group.
Remark | Accepts data fields or cell references. (v2016.3.8+) Optional second argument indicates whether to count: True - records, False - entities (default).
Example | Ex. aggSum({OrderDetail.Quantity}) - returns the total quantity of units ordered.

# RunningSum

Description | Returns a running total of the input cell.
Remark | Takes one, two, or three input: The cell you want to sum. OPTIONAL: A Data Field or Category. The running sum will reset to 0 whenever there is a new value for this Data Field or Category. (v2016.3.8+) OPTIONAL: Whether to count: True - records, False - entities (default). NOTE. RunningSum should not be used with the AutoSum feature.
Example | Ex. 1. RunningSum({Employees.Salary}) – returns running total of all the employee’s salary. 2. RunningSum({Employees.Salary}, {Employees.Region}) – returns a running total of employee’s salary for each region. 3. RunningSum({Employees.Salary}, {Company}) – returns a running total of employee’s salary for each Company.

# AggMedian

Description | Returns the median, or the middle value, of a data set.
Remark | Accepts data fields or cell references. Optional second argument indicates whether to count: True - records, False - entities (default). Available in version 2017.2 and later.
Example | Ex. aggMedian({OrderDetail.Quantity}) - returns the median order quantity.

# AggMode

Description | Returns the mode, or the value that appears most often, of a data set.
Remark | Accepts data fields or cell references. Optional second argument indicates whether to count: True - records, False - entities (default). Available in version 2017.2 and later.
Example | Ex. aggMode({OrderDetail.Quantity}) - returns the mode of order quantity.

# AggStandardDeviation

Description | Returns the standard deviation (SD) of a data set. SD is used to quantify the spread of the values in a data set. A lower SD indicates that values are close to the mean, and a higher SD indicates that values are more spread.
Remark | Accepts data fields or cell references. Takes one, two, or three input: The cell to get the standard deviation OPTIONAL: String value, one of "Sample" or "Population" indicating whether to calculate Sample-based or Population-based standard deviation, respectively. OPTIONAL: whether to count: True - records, False - entities (default). Available in version 2017.2 and later.
Example | Ex. aggStandardDeviation({OrderDetail.Quantity}) - returns the standard deviation of order quantities.

# AggVariance

Description | Returns the variance of a data set. Variance is used to quantify the spread of the values in a data set, and is equal to the square of the standard deviation. Variance weighs outliers more heavily than standard deviation.
Remark | Accepts data fields or cell references. Takes one, two, or three input: The cell to get the variance OPTIONAL: String value, one of "Sample" or "Population" indicating whether to calculate Sample-based or Population-based variance, respectively. OPTIONAL: whether to count: True - records, False - entities (default). Available in version 2017.2 and later.
Example | Ex. aggVariance({OrderDetail.Quantity}) - returns the variance of order quantities.