Format
DDAverage(InputValues)
Returns
Calculates the average of the input values for each timestamp.
Typically, this function is used on the return value of a DDGet() or DDGetAttributes() call, since these functions can return multiple values for a single timestamp (by fetching the attribute of several entities).
Inputs
InputValues: A collection of values where each value contains the necessary metadata (see Useful to Know below) which indicates the name of the source entity (DDGet() and DDGetAttributes() can produce such return values).
Behaviour: Required
Dimensions: MultiCollection
Valid data types: Decimal, Integer
Useful to Know
In the calculation engine, values returned by DD() functions have metadata assigned to them, such as entity name and start/end times. Other DD() functions can use this metadata to assign additional information to values they receive. In this way, the metadata is used by nested DD() functions to reduce complexity but increase versatility. Which metadata is used and how it is used is specific to each function, and is described in the Input Values section above, where applicable.
Examples
Expression: DDAverage(DDGetAttributes(DDGetEntities("myHierarchy", 2, "rootEntity"), ":myAttribute"))
Description: Produces a similar result to "Average({childEntity1:myAttribute}, {childEntity2:myAttribute},... {childEntityN:myAttribute})".
Result: Returns the average of all fetched values of "myAttribute" for each child entity at a maximum of 2 levels below the "rootEntity" in "myHierarchy".
Expression: DDAverage({SampleDDGet})
Returns: The average of all fetched values in the SampleDDGet calculation tag. This tag is actually the same as the DDGet() function in the below example.
Result: 63.72127939499352
Expression: DDAverage(DDGet("P2 Corporate", 5, "Western Australia", ":Oil Production", "{[Oil Producing Well]:Status} == 0", "Oil Producing Well"))
Returns: The average oil production, for each timestamp, of each Oil Producing Well in Western Australia, in the P2 Corporate hierarchy, where the well is online (status is 0).
Result: 63.72127939499352
Release History
- DDAverage() 4.6.5
- Changed InputValues parameter dimension from Collection to MultiCollection.
- DDAverage() 4.5.0
- Initial version