first_not_null
first_not_null(expression: storable, [order_by(...)]?) -> expression
first_not_null has the same arguments and aggregate versus window rules as first, but it ignores null values in the expression when picking which value to return. Among rows that participate in the group, the first non-null value in ordering order is returned. If every value is null the result is null.
Domain
This is an aggregate function (aggregates rows over a group in aggregate verbs).
This is a window function (calculates over a group of multiple input rows using windowing).
Categories
Examples
aggregate first_ip:first_not_null(client_ip, order_by(valid_from)), group_by(session_id)
Selects the earliest non-null client_ip per session, skipping leading null measurements.
Updated 18 days ago