Aggregation functions are used to operate on a set of values to return a single value; for example, to provide the value of a key performance indicator (KPI) or measure based on a set of metrics.
Aggregation Function | Description |
---|---|
Minimum | Returns the smallest value from the set of values |
Maximum | Returns the largest value from the set of values |
Sum | Adds the values and returns the total |
Count | Counts the number of values |
Average | Calculates the average of the set of values. When a counter or integer metric is aggregated as a measure using the Average function, the resulting value is an integer. To get decimal precision, you must aggregate using an underlying metric that is of type Decimal. Counters and integer metrics can be copied to a decimal metric if decimal precision is required. |
Standard Deviation | Calculates how widely spread the values are |
Null values are not included in the calculation. For example, the Count function counts the number of values that are not null. Suppose you create a metric that can have a value of either 0 or 100. You define a measure based on the metric and use the Count aggregation function. If there are three instances of the measure, one with a value of 0, a second with a value of 100, and a third with no value (null), the count is 2.
Similarly, the Average function averages the values that are not null. Suppose you have an Average Order Amount measure that points to an Order Amount metric. At run time, you have three instances with order amounts of $100, $200, and null. The Average Order Amount measure ignores the null instance and has a value of $150.
Type | Valid Aggregation Functions |
---|---|
Boolean | Count |
Date | Minimum, Maximum, Count |
DateTime | Minimum, Maximum, Count |
Decimal | Average, Minimum, Maximum, Sum, Count, Standard deviation |
Duration | Average, Minimum, Maximum, Sum, Count |
Integer | Average, Minimum, Maximum, Sum, Count, Standard deviation |
String | Count |
Time | Minimum, Maximum, Count |
Stopwatch | Average, Minimum, Maximum, Sum, Count |
Counter | Average, Minimum, Maximum, Sum, Count, Standard deviation |