average
Full name: taxi.stdlib.average
Signature
declare extension function average(values: Any[]):DecimalDescription
Returns the arithmetic mean of a collection of numeric values.
All values in the collection must be of the same numeric primitive type (Int, Decimal, etc.). Returns null if the collection is empty or contains non-numeric values.
find { order: Order } as {
averageItemPrice: Decimal = order.items.map((Item) -> Item::price).average()
}Examples
Computes the average score from a collection of items.
Try it out
Schema
Query Plan
Play with this snippet by editing it here, or edit it on Taxi Playground
Result
Query failed