select
(sum(gas_used/pow(10,9)) * avg(price))/count(distinct block_id) as fee_per_block
from osmosis.core.fact_transactions inner join osmosis.core.dim_prices p
on RECORDED_AT::date = block_timestamp::date and hour(p.RECORDED_AT) = hour(block_timestamp)
where block_timestamp > CURRENT_DATE - 31
and tx_status = 'SUCCEEDED'
and symbol = 'OSMO'