with active as (
select
distinct(from_address) as users
from gnosis.core.fact_transactions
where block_timestamp >= current_date - 30
),
transactions as (
select
active.users as users,
count(tx_hash) as tx_count
from gnosis.core.fact_transactions as transactions
inner join active on transactions.from_address = active.users
where block_timestamp >= current_date - 30
group by active.users
)
select
avg(tx_count) as avg_tx
from transactions