Skip to content

Math ​

The Math node performs aggregate calculations on a numeric field across all input rows. It returns a single scalar value (not an array).

Configuration ​

PropertyTypeDefaultDescription
operationstringsumThe aggregation function to apply.
fieldstring--Required. The numeric field to aggregate.

Operations ​

OperationDescription
sumSum of all values in the field.
avgAverage (mean) of all values.
minSmallest value.
maxLargest value.
countNumber of rows.

Input ​

Accepts an array of rows. Each row must have the specified field with a numeric value. Non-numeric values are treated as 0.

Output ​

Returns a single number (not an array of rows).

OperationExample InputOutput
sum[{price: 10}, {price: 20}, {price: 30}]60
avg[{price: 10}, {price: 20}, {price: 30}]20
min[{price: 10}, {price: 20}, {price: 30}]10
max[{price: 10}, {price: 20}, {price: 30}]30
count[{price: 10}, {price: 20}, {price: 30}]3

Example Use Cases ​

Calculate total revenue ​

operation: "sum"
field: "total"

Show average rating ​

operation: "avg"
field: "rating"

Find the cheapest product ​

operation: "min"
field: "price"

Count items in a category ​

operation: "count"
field: "id"

Dashboard statistics ​

Use multiple Math nodes with a Combine node to build a dashboard:

Table Query (orders)  --> Math (sum, field: "total")      --> Combine (var1: "revenue")
Table Query (orders)  --> Math (count, field: "id")       --> Combine (var2: "order_count")
Table Query (orders)  --> Math (avg, field: "total")      --> Combine (var3: "avg_order")
Table Query (users)   --> Math (count, field: "id")       --> Combine (var4: "user_count")

WARNING

The Math node returns a scalar value, not an array. If you need to use the result alongside other data, pipe it into a Combine node or a Set Field node to embed it in a row.