Updated 2023-09-03
    select
    date_trunc('{{Time_basis}}',first_transaction_stamp) as date,
    Project_name,
    count (distinct sender) as new_users_near,
    rank() over (partition by date order by new_users_near desc) as order_rank
    from (
    select
    distinct TX_SIGNER as sender,
    Project_name,
    min(block_timestamp) as first_transaction_stamp
    from near.core.fact_transactions s
    left join near.core.dim_address_labels a on s.TX_RECEIVER = a.address
    WHERE block_timestamp >= current_date-interval '{{Months_back}} months'
    group by 1,2 having Project_name is not null
    )
    where date >= current_date- interval '{{Months_back}} months'
    group by 1,2
    qualify order_rank<=5
    Run a query to Download Data