vendetta11are copy
    Updated 2023-02-23
    -- forked from 175664b7-e5b4-4000-abd6-69c5d74b44e0

    with new_users_first_currency as (
    select first_user,first_project,first_date , row_num from (
    select sender as first_user ,project_name as first_project , min(block_timestamp) as first_date
    , ROW_NUMBER() OVER (PARTITION BY first_user ORDER BY first_date) as row_num
    from osmosis.core.fact_transfers inner join osmosis.core.dim_labels
    on currency=address
    group by 1,2
    UNION
    select TRADER as first_user ,project_name as first_project , min(block_timestamp) as first_date
    , ROW_NUMBER() OVER (PARTITION BY first_user ORDER BY first_date) as row_num
    from osmosis.core.fact_swaps inner join osmosis.core.dim_labels
    on from_CURRENCY=address
    group by 1,2
    UNION
    select TRADER as first_user ,project_name as first_project , min(block_timestamp) as first_date
    , ROW_NUMBER() OVER (PARTITION BY first_user ORDER BY first_date) as row_num
    from osmosis.core.fact_swaps inner join osmosis.core.dim_labels
    on to_CURRENCY=address
    group by 1,2)
    where row_num=1)

    select count(*) , first_project, date_trunc('week', first_date) from new_users_first_currency
    where
    first_project in ('MARS','BUSD','wBNB','wAVAX','ACRE','arUSD','NOM','qSTARS','WYND','CANTO' ,'wFTM' , 'PLQ' , 'HOPERS' , 'DYS' , 'SHIB' )
    and first_date > '2022-11-01'
    group by 2 , 3


    Run a query to Download Data