Query editor
with transaction_daily as (select date_trunc('day', block_time) as block_date,sum(cast(gas_used as double) * coalesce(cast(gas_price as double), 1)) / 1e18 as gas_used,sum(cast(gas_used as double) * coalesce(cast(gas_price as double), 1) / 1e18 * p.price) as gas_used_usdfrom base.transactions tleft join prices.usd p on date_trunc('minute', t.block_time) = p.minute and p.contract_address = 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 -- WETHwhere cast(gas_price as double) > 0group by 1)select block_date,gas_used,gas_used_usd,avg(gas_used) over (order by block_date rows between 6 preceding and current row) as ma_7_days_gas_used,avg(gas_used_usd) over (order by block_date rows between 6 preceding and current row) as ma_7_days_gas_used_usdfrom transaction_dailyorder by block_date