walemathsNew User Activities Tracker
    Updated 2024-08-07
    -- forked from Masi / New Per Label Type @ https://flipsidecrypto.xyz/Masi/q/dO4HqGdChO8M/new-per-label-type

    with tb1 as ( select block_timestamp,
    LABEL_TYPE,
    project_name,
    tx_signer as user
    from near.core.fact_transactions a join near.core.dim_address_labels b on a.tx_receiver = b.address
    where TX_SUCCEEDED = 'true'
    UNION
    select block_timestamp,
    label_type,
    project_name,
    tx_receiver as user
    from near.core.fact_transactions a join near.core.dim_address_labels b on a.tx_signer = b.address
    where TX_SUCCEEDED = 'true'
    )
    ,
    tb2 as ( select min(block_timestamp) as min,
    min(label_type) as min_label,
    user
    from tb1
    group by 3)

    select trunc(min,'month') as monthly,
    min_label as label,
    count(DISTINCT user) as new_users
    from tb2
    where min::date >= '2023-01-01'
    group by 1,2




    QueryRunArchived: QueryRun has been archived