Query editor
with polygon_data as (selectblock_month as time, sum(amount_usd) as total_amt_usd_polygonfrom tokens_polygon.transferswhere to = 0x7AfA9D836d2fCCf172b66622625e56404E465dBDand block_time between timestamp '{{start_date}}' and timestamp '{{end_date}}'group by 1), ethereum_data as(selectblock_month as time, sum(amount_usd) as total_amt_usd_ethfrom tokens_ethereum.transferswhere to = 0x7AfA9D836d2fCCf172b66622625e56404E465dBDand block_time between timestamp '{{start_date}}' and timestamp '{{end_date}}'group by 1), base_data as(selectblock_month as time, sum(amount_usd) as total_amt_usd_basefrom tokens_base.transferswhere to = 0x7AfA9D836d2fCCf172b66622625e56404E465dBDand block_time between timestamp '{{start_date}}' and timestamp '{{end_date}}'group by 1), final as(selecttime, total_amt_usd_polygon + total_amt_usd_eth + COALESCE(total_amt_usd_base,0) as total_evm_fee, total_amt_usd_polygon, total_amt_usd_eth, COALESCE(total_amt_usd_base,0) as total_amt_usd_base, sum(total_amt_usd_polygon) over(order by time asc) as total_amt_usd_polygon_cul, sum(total_amt_usd_eth) over(order by time asc) as total_amt_usd_eth_cul, sum(COALESCE(total_amt_usd_base,0)) over(order by time asc) as total_amt_usd_base_culfrom polygon_datajoin ethereum_data using (time)right join base_data using (time)group by 1,2,3,4,5)select*,sum(total_evm_fee) over(order by time asc) as total_evm_fee_culfrom final