with tab1 as (
select
tx_from as users,
min(block_timestamp) as min_date
from osmosis.core.fact_transactions
group by users
)
select 'new users' as type,
date_trunc('week',min_date) as date,
count(users) as new_users
from tab1
group by 1,2
union all
select 'daily users' as type,
date_trunc('week',block_timestamp) as date,
count(distinct tx_from) as count_users
from osmosis.core.fact_transactions
group by 1,2