This article lists Aggregate Functions that can be used within Model Calculation expressions.
Aggregation is an operation that combines values from multiple records into a single value.
Within Model Calculation expressions, Aggregate Functions can currently only be used on child records. It is also possible to perform aggregation on “grandchild” and other Groups lower in the database hierarchy.
Please see the Aggregation in Model Calculations guide for more information and examples.
For additional information on other functions and expressions in general, please see our Functions Guide and Expressions Guide.
Aggregation is performed slightly differently within Template Studio expressions. Please see the Aggregation in Templates guide for more information. Also note that the functions listed here only apply to Model Calculation expressions. A slightly different list of Aggregate Functions are available for Template expressions.
Calculates the average of the values.
Average([ChildGroup.NumericHeader])
Counts the number of records where the specified Header contains data.
Count([ChildGroup.Header])
Counts the number of records for the Group whether the specified Header contains data or not.
CountRecords([ChildGroup.Header])
Determines the first value from a list of values. As described in the Aggregation in Model Calculations guide, records are ordered by Key Headers.
First([ChildGroup.Header])
Performs linear interpolation on a dataset to return a value for a given “lookup value”.
The function computes the return value by performing piecewise linear interpolation between the two points within the dataset that fall before and after the lookup value.
As described in the Aggregation in Model Calculations guide, records are ordered by Key Headers when performing the interpolation.
The function takes two forms – with or without optional ScaleOptions, which can be used to specify arithmetic or logarithmic scales.
Interpolate(LookupValues, ReturnValues, LookupValue)
Interpolate(LookupValues, ReturnValues, LookupValue, LookupValueScaleOption, ReturnValueScaleOption)
When performing the calculation, the following validations are performed:
Example
Interpolate() can be used to calculate D60 for a Particle Size Distribution test (particle size at which 60% of the soil particles are smaller) using the expression below in the ParticleSizeDistributionGeneral Group. The LookupValues (PercentagePassing) use an arithmetic scale (null) and the ReturnValues (ParticleSize) use a logarithmic scale (10).
Interpolate(
[ParticleSizeDistributionData.PercentagePassing],
[ParticleSizeDistributionData.ParticleSize],
60,
null,
10
)
Returns a value for a given "lookup value" along a linear best fit line through a dataset.
The function takes two forms – with or without optional ScaleOptions which can be used to specify arithmetic or logarithmic scales.
InterpolateBFLinear(LookupValues, ReturnValues, LookupValue)
InterpolateBFLinear(LookupValues, ReturnValues, LookupValue, LookupValueScaleOption, ReturnValueScaleOption)
When performing the calculation, the following validations are performed:
Example
In this example, InterpolateBFLinear() will be used to determine a "representative" N-Value (ReturnValue) at 3 m depth (LookupValue) using the expression below. The ScaleOptions are omitted, in which case arithmetic scales are used. (This example is intended for illustrative purposes of the function usage rather than a real world example.)
InterpolateBFLinear(
[SPT.DepthTop],
[SPT.NValue],
3
)
Looking at the results, we see a value has been computed for all Locations except BH3 where the LookupValue (3) is outside the range of the LookupValues (DepthTop).
Determines the last value from a list of values.
As described in the Aggregation in Model Calculations guide, records are ordered by Key Headers.
Last([ChildGroup.Header])
MaxAggregate() is an alias for MaxAll(). (It returns the same results as MaxAll(). MaxAggregate() can just be used as the function name instead.)
Determines the maximum value from a list of values.
(Note there is also a max() function, which is not an Aggregate Function.)
MaxAll([ChildGroup.NumericHeader])
MinAggregate() is an alias for MinAll(). (It returns the same results as MinAll(). MinAggregate() can just be used as the function name instead.)
Determines the minimum value from a list of values.
(Note there is also a min() function, which is not an Aggregate Function.)
MinAll([ChildGroup.NumericHeader])