select count(distinct FROM_ADDRESS) as unique_addresses,
count(distinct TX_HASH) as count_tx,count_tx/unique_addresses as avg_tx_user,
date_trunc('day', block_timestamp) as block_day,
case
when block_timestamp >= '2022-06-01 00:00:00.000' and block_timestamp < '2022-07-01 00:00:00.000' then 'June'
when block_timestamp >= '2022-07-01' then 'July'
end as time_category
from polygon.core.fact_transactions
where block_timestamp >= '2022-06-01 00:00:00.000'
group by block_day,time_category