Query editor
WITHfl AS (SELECT chain, evt_block_time, evt_tx_hash, evt_index, initiator, facilitator_contract, totalusd, tx_classFROM dune.boc.result_all_evm_flash_loans_classifiedWHERE evt_block_time < TIMESTAMP '2025-01-01'),grouped AS (SELECT date_trunc('week', evt_block_time) as period, tx_class, COUNT(*) as freq, SUM(totalusd) as valueFROM flGROUP BY 1, 2),date_series AS (SELECT DISTINCT date_trunc('week', fl.evt_block_time) as period, c.tx_classFROM flCROSS JOIN (SELECT DISTINCT tx_class FROM fl) c),expanded AS (SELECT d.period, d.tx_class, COALESCE(f.freq, 0) as freq, COALESCE(f.value, 0) as valueFROM grouped fLEFT JOIN date_series dON f.period = d.periodAND f.tx_class = d.tx_class)SELECT *FROM expanded