You are viewing the documentation for Blueriq 17. Documentation for other versions is available in our documentation directory.
AVERAGE (AVG)
Use this function to determine the average (arithmetic mean) of a list or collection.
The AVG function has two syntax forms: the collection form and the list form. You can use the collection form to determine the average value of all occurrences of an attribute. The list form is used to determine the average value of a set of different attributes.
1. Collection form syntax
AVG ( attribute )
Input
- attribute - An attribute of any type of integer, number or date of which multiple instances can occur at runtime.
2. List form syntax
AVG ( [ value1 , value2 , ... ] )
Inputs
- [ value1 , value2 , … ] - A list of attributes, expressions or fixed values of any type of integer, number or date. Use the square brackets to indicate that the arguments form a list of values.
Return types
- number
- currency
- percentage
- date
The function returns UNKNOWN if one or more values are UNKNOWN.
Examples
Suppose the following domain model.
Entity.attribute | Value | Multivalued relation | Entity.attribute | Values |
---|---|---|---|---|
Residence.appraisalValue Residence.askingPrice Residence.mortgage | € 140000 € 150000 € 142000 | hasBiddings | Bidding.amount | € 132000 € 139000 € 137500 |
Goal | Expression | Result | Type |
---|---|---|---|
To determine the average amount within the appraisal value, the asking price and the mortgage | AVG ( [ Residence.appraisalValue , Residence.askingPrice , Residence.mortgage ] ) | € 144000 | Currency |
To determine the average bidding on the current residence | AVG ( Residence.hasBiddings.amount ) | € 136166.67 | Currency |
Overview
Content Tools