MasiNew Addresses copy
    Updated 2024-05-06
    -- forked from New Addresses @ https://flipsidecrypto.xyz/edit/queries/034fee20-4b10-4c06-9eeb-4dfdd6c96c70

    with tb1 as ( select block_timestamp,
    tx_signer as user
    from near.core.fact_transactions
    where TX_SUCCEEDED = 'true'
    UNION
    select block_timestamp,
    tx_receiver as user
    from near.core.fact_transactions
    where TX_SUCCEEDED = 'true'
    )
    ,
    tb2 as ( select min(block_timestamp) as min,
    user
    from tb1
    group by 2)
    ,
    tb3 as (select trunc(min,'day') as daily,
    count(DISTINCT user) as users
    from tb2
    where min::date >= '2024-03-01' and min::date < '2024-05-01'
    group by 1)
    ,
    tb4 as (select daily,
    case when daily >= '2024-03-01' and daily < '2024-04-01' then 'March' else 'April' end as month,
    users,
    rank() over (partition by month order by daily asc) as day
    from tb3
    )

    select month,
    sum(users) as new
    from tb4
    group by 1


    QueryRunArchived: QueryRun has been archived