Type alias AggregatorName

AggregatorName: "sum" | "count" | "avg" | "min" | "max" | "countDistinct" | "first" | "last"

The names of the built-in aggregators (Aggregators).

name result uses
sum sum, 0 for no numbers numbers (NaN ignored)
count number of rows every row – the value does not matter
avg sum / count of the numbers, undefined for none numbers
min, max smallest / largest value, undefined for none numbers and valid Dates
countDistinct number of different values everything except null/undefined; dates by time
first, last value of the first / last row every row, the value as it is

Text is never converted to a number (like Excel's SUM over a range): "12" does not count. Use an accessor such as row => Number(row.amount) for numbers stored as text.

Example

const name: AggregatorName = "avg";
aggregate(orders, "total", name);

Since

1.1.94