SocioAnalyticanew user 2024
    Updated 2024-03-26
    -- forked from active user 2023 @ https://flipsidecrypto.xyz/edit/queries/8ec0e9f1-15bc-44bf-a2dc-31333dd24464

    with all_user as (
    SELECT
    block_timestamp,
    tx_hash,
    tx_receiver,
    tx_signer,
    row_number() over (partition by tx_signer order by block_timestamp) as rank
    FROM near.core.fact_transactions
    WHERE TX_SUCCEEDED
    )

    SELECT
    project_name,
    label_type as sector,
    count(DISTINCT case when block_timestamp::date BETWEEN '2023-01-01' and '2023-03-30' then tx_signer end) as new_user_q1_2023,
    count(DISTINCT case when block_timestamp::date BETWEEN '2024-01-01' and '2024-03-30' then tx_signer end) as new_user_q1_2024,
    (new_user_q1_2024 - new_user_q1_2023) / new_user_q1_2024 as ratio
    FROM all_user a
    LEFT JOIN near.core.dim_address_labels b
    on a.tx_receiver = b.address
    WHERE block_timestamp :: date >= '2023-01-01'
    AND project_name is not null
    AND label_type not in ('token', 'operator')
    and rank = 1
    GROUP by 1 , 2
    having new_user_q1_2024 > 0
    and new_user_q1_2024 > 0
    ORDER BY ratio DESC
    LIMIT 30





    QueryRunArchived: QueryRun has been archived