Multiple Aggregation Projections in fluxql

Hello @Nam_Giang,
I wouldn’t recommend it because reduce() should really be reserved for custom aggregators. Using from() + range() + filter() + a bare aggregate or selector (like min or max) is a pushdown pattern for InfluxDB meaning that the transformation work is executed in storage rather than memory and is much more computationally efficient.
Please see:

But… here you go (I just wrapped in in a function):

minMaxMean = (tables=<-) =>
  tables
    |> reduce(
      identity: {count: 0.0, sum: 0.0, min: 0.0, max: 0.0},
      fn: (r, accumulator) => ({
        count: accumulator.count + 1.0,
        min: if accumulator.count == 0.0 then r._value else if r._value < accumulator.min then r._value else accumulator.min,
        max: if accumulator.count == 0.0 then r._value else if r._value > accumulator.max then r._value else accumulator.max,
      })
    )