MLDZMNusers2
    Updated 2023-05-12
    with t2 as (select
    distinct swapper as users,
    Count(distinct tx_id) as no_txn,
    count (Distinct block_timestamp::Date) as active_days,
    min (block_timestamp) as first_transaction,
    datediff(day,first_transaction,CURRENT_DATE) as wallet_age

    from solana.core.fact_swaps
    where SUCCEEDED='TRUE'
    and PROGRAM_ID ilike 'JUP%'
    group by 1)

    select
    case
    when active_days<=5 then 'under 5 Days'
    when active_days > 5 and active_days <= 20 then '5- 20 Days'
    when active_days > 20 and active_days <= 50 then '20- 50 Days'
    when active_days > 50 then 'over 50 Days'
    end as gp,
    count(distinct users) as no_users
    from t2
    group by 1 having gp is not null


    Run a query to Download Data