Scroll

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, several aggregate functions, as indicated below, 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.

 

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.

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.

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.

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 or two input:

1. The cell you want to sum.
2. 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 third argument indicates 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.

 


Hidden Article Information

Article Author
Nick
created 2015-12-16 15:17:54 UTC
updated 2017-10-02 21:33:57 UTC

Labels
aggregate, functions, Agg, RunningSum, Function Examples,
Have more questions? Submit a request