with intermediate as
, lead(event_type) over (order by measure_time) end_event
, lead(measure_time) over (order by measure_time) end_time
event_type like 'BACKUP%'
, cast(trunc(measure_time, 'DD') as date) start_date
, cast(round(minutes_between(end_time, measure_time)/60, 2) as decimal(10,2)) backup_duration
event_type = 'BACKUP_START' and end_event not like '%START'
and measure_time > trunc(now(), 'YYYY')