cybergenlab[Ecosystem metrics] User growth
    Updated 2024-11-16
    --Get historical project user growth

    with monthly_new_users as (
    select
    date_trunc('month', block_timestamp) as time,
    coalesce((label_type), 'other') as category,
    count(distinct from_address) as new_users,
    from ethereum.core.fact_transactions as transactions
    left join ethereum.core.dim_labels labels on transactions.to_address = labels.address
    where block_timestamp >= dateadd(year, -3, date_trunc('month',current_date()))
    and nonce = 0
    and block_timestamp < date_trunc('month',current_date())
    and category not in ('token', 'cex', 'chadmin', 'operator', 'flotsam', 'other')
    and status = 'SUCCESS'
    group by 1,2
    )

    , new_users_table as (
    select
    time,
    sum(new_users) as new_users
    from monthly_new_users
    group by 1
    )

    , user_growth as (
    select
    time,
    new_users,
    sum(new_users) over (order by time) as users
    from new_users_table
    group by 1,2
    )

    select * from user_growth
    order by 1 desc
    QueryRunArchived: QueryRun has been archived