shreexUser Metrics For Terra
    Updated 2022-12-30
    with new_wallets as (
    select
    distinct tx_sender as wallet,
    min(block_timestamp::date) as date1
    from terra.core.fact_transactions
    group by wallet
    ),
    active_wallets as (
    select
    date_trunc('week',block_timestamp::date) as active_date,
    tx_sender as wallets,
    count(*) as txs
    from terra.core.fact_transactions
    GROUP BY 1,2
    HAVING count(*) >= 4
    )
    select
    date_trunc('week',date1) as date,
    count(distinct wallet) as new_users,
    count(distinct wallets) as active_wallets,
    avg(active_wallets) over (order by date) as avg_active_wallets,
    sum(new_users) over (order by date) as cumulative_new_users,
    avg(new_users) over (order by date) as average_new_users
    from new_wallets left join active_wallets on date1=active_date where date1=active_date
    GROUP BY DATE
    ORDER BY DATE
    Run a query to Download Data