with tpm as (
select
date_trunc('minute', block_timestamp) as mnt,
'Flow' as chain,
count(distinct tx_id) as tx_cnt,
avg(tx_cnt) over (order by mnt asc) as avg_tx_cnt
from
flow.core.fact_transactions
where
TX_SUCCEEDED and block_timestamp >= '2022-07-01'
group by 1
)
select
avg(tx_cnt) as total_avg_tpm
from
tpm