Query editor
withtx as (selectmin(timestamp) as request_time,min(blockNumber) as request_block,from_hex(CAST(json_extract(transactions, '$[0].hash') AS VARCHAR)) as user_txfrom mevblocker.raw_bundlesgroup by CAST(json_extract(transactions, '$[0].hash') AS VARCHAR)),prep as (SELECTblock_time, block_number,sum(cast(t.gas_used as UINT256)*(gas_price-base_fee_per_gas)/1e18) as totals,sum(0.1*cast(t.gas_used as UINT256)*(gas_price-base_fee_per_gas)/1e18) as totals1,sum(0.1*cast(t.gas_used as UINT256)*(gas_price-base_fee_per_gas)/1e18- ((base_fee_per_gas*21000)/1e18)) as totals2FROM ethereum.transactions as tleft join ethereum.blocks bon b.number=t.block_numberWHERE block_time BETWEEN TIMESTAMP '2023-04-27' AND DATE_TRUNC('day',NOW())AND t.hash in (select user_tx from tx)group by 1,2)select DATE_TRUNC('month', date(block_time)) AS month,sum(case when totals2>0 then totals2 end) as totals2,sum(totals1) as totals1,sum(totals) as totalsfrom prepgroup by 1