DerivedExpression
Types
metric of the group shift steps earlier along the DATE_HISTOGRAM group along, every other group key equal: a step is one bucket of along, the bucket before in its sequence of buckets (across a daylight-saving transition too, never the bucket itself), or one period (such as YEAR for the same period last year: the bucket holding the same local time then). The earlier groups are read over the query's own range of along's field, shifted alike. null when that group has no records.
metric accumulated along order over the groups that share this group's within keys: the function of every group up to and including this one, or of the last frame of them. Groups tied on order follow the remaining group keys ascending, in groupBy order. null when every value in the frame is null. SUM accepts only COUNT and SUM; AVG, a moving average with frame, accepts any numeric metric.
A window over the groups of the aggregation: computed from every group the filter selects, after the row-level derived metrics and before HAVING, sort and limit, so neither HAVING nor the limit changes it. metric names a non-derived numeric metric declared before the derived metric. A null metric value contributes nothing.