Basic Aggregation Functions

Overview

Basic aggregation functions are a group of the most common aggregation functions. Use the drop-down on each function to see a brief description and the syntax of each function.

Basic Aggregation Functions in Chart Expressions

Chart aggregation functions can only be used on fields in chart Expressions. The argument Expression of one aggregation function must not contain another aggregation function.

FirstSortedValueClosed

FirstSortedValue() returns results from the Expression in the value that corresponds to the result of sorting the sort_weight argument (for example, the name of the product with the lowest unit price). The nth value in the sort order, can be specified in rank. If more than one resulting value shares the same sort_weight for the specified rank, the function returns NULL.

firstsortedvalue([{SetExpression}] [DISTINCT] [TOTAL [<fld {,fld}>]] value, sort_weight [,rank])
MaxClosed

Max() finds the highest value of the aggregated data. By specifying a rank n, the nth highest value can be found.

max([{SetExpression}] [DISTINCT] [TOTAL [<fld {,fld}>]] expr [,rank])
MinClosed

Min() finds the lowest value of the aggregated data. By specifying a rank n, the nth lowest value can be found.

min([{SetExpression}] [DISTINCT] [TOTAL [<fld {,fld}>]] expr [,rank])
ModeClosed

Mode() finds the most commonly-occurring value, the mode value, in the aggregated data. The Mode() function can process text values as well as numeric values.

mode ({[SetExpression] [TOTAL [<fld {,fld}>]]} expr)
OnlyClosed

Only() returns a value if there is one and only one possible result from the aggregated data. For example, searching for the only product where the unit price =9 will return NULL if more than one product has a unit price of 9.

only([{SetExpression}] [DISTINCT] [TOTAL [<fld {,fld}>]] expr)
SumClosed

Sum() calculates the total of the values given by the Expression or field across the aggregated data.

sum([{SetExpression}] [DISTINCT] [TOTAL [<fld {,fld}>]] expr])