mz0111near 8
    Updated 2023-05-18
    with tab1 as
    (select
    distinct TX_SIGNER as new_user,
    min(BLOCK_TIMESTAMP) as first_day
    from near.core.fact_transactions
    where TX_STATUS = 'Success'
    group by 1)

    select
    date_trunc('week',BLOCK_TIMESTAMP) as date,
    count(distinct TX_SIGNER) as users,
    b.LABEL_TYPE,
    b.PROJECT_NAME,
    sum(users) over (partition by b.LABEL_TYPE order by date) as cumulative_users
    from near.core.fact_transactions a
    join near.core.dim_address_labels b
    on b.ADDRESS = a.TX_RECEIVER
    join tab1 c on c.new_user = TX_SIGNER
    where TX_STATUS = 'Success'
    and first_day >= current_date - {{period}}
    group by 1 , 3 , 4
    order by 1
    Run a query to Download Data