Query editor
withtotal_op as (selectblockchain as chain,*fromaccount_abstraction_erc4337.useropswheresuccess = trueand block_time >= "date" ('2023-06-01')),network_fees as (select*fromquery_3544679),calcs_1 as (selectdate_trunc('week', block_time) as dt,chain,count(distinct tx_hash) tx_count,count(distinct userop_hash) userop_count,avg(op_fee_usd) as avg_op_fee_usd,approx_percentile(op_fee_usd, 0.5) AS median_op_fee_usd--avg(tx_fee_usd) as avg_tx_fee_usd--approx_percentile(tx_fee_usd, 0.5) AS median_tx_fee_usdfromtotal_opgroup by1,2),joined as (select*fromcalcs_1 cinner join network_fees n on c.chain = n.chainand c.dt = n.dt),calcs_2 as (select*,CAST(median_op_fee_usd AS DOUBLE) / CAST(median_usd_fee_per_tx AS DOUBLE) * 1 - 1 as median_op_over_tx,CAST(avg_op_fee_usd AS DOUBLE) / CAST(avg_usd_fee_per_tx AS DOUBLE) * 1 - 1 as avgs_op_over_txfromjoinedorder by1 desc,3 desc)select*fromcalcs_2order by 1 desc, 4 desc