select
(sum(gas_limit/pow(10,9)) * avg(price_usd))/((sum(amount)*avg(price_usd))/1000000)
from flow.core.ez_token_transfers t
inner join flow.core.fact_transactions ft on t.tx_id = ft.tx_id
inner join flow.core.fact_prices p
on timestamp::date = ft.block_timestamp::date and hour(timestamp) = hour(ft.block_timestamp)
where ft.block_timestamp > CURRENT_DATE - 31
and token = 'Flow'
and ft.tx_succeeded = 'TRUE'
and t.token_contract = 'A.1654653399040a61.FlowToken'