Query editor
SELECT DISTINCTsection,method,block_time,extrinsic_id,event_id,row_number() over (partition BYextrinsic_idORDER BYCAST(reverse(split(event_id, '-')) [1] as integer)) - 1 as rn,IF((method = 'ItemFailed' or method = 'BatchInterrupted'), True, False) as is_failed,CAST(JSON_EXTRACT_SCALAR(JSON_PARSE(data), '$[0]') AS integer) AS fail_start_indexFROMpolkadot.eventswhereblock_time > DATE '2023-05-30'and section = 'utility'and (method = 'ItemFailed'or method = 'BatchInterrupted'--or method = 'ItemCompleted')