Analytics Engineering, Bigquery, Sql, Data Engineering, Editors Pick.
start_datetime DESC) as next_event_datetime FROM UNNEST(promotion_history) ORDER BY start_datetime ) as promotion_history, ... The second step consists of introducing new events whenever such a discontinuity happens, like this: SELECT ... ARRAY ( SELECT AS STRUCT promotion_value, start_datetime,