Hadisehnew user 3
    Updated 2022-09-07
    with new_user as ( select min(block_timestamp) as day, tx_signer
    from near.core.fact_transactions
    group by 2)
    ,
    tb1 as ( select dayname(day) as day,
    count(DISTINCT tx_signer) as total
    from new_user
    where day >= CURRENT_DATE - 90
    group by 1)
    ,
    tb2 as ( select *
    from new_user
    where day::date >= CURRENT_DATE - 90)
    ,
    tb3 as (select dayname(block_timestamp) as day,
    count(DISTINCT tx_hash) as total
    from near.core.fact_transactions
    where tx_signer in ( select tx_signer from tb2)
    group by 1
    order by 1)

    select 'New Users' as status,
    day,
    total
    from tb1
    UNION
    select 'Transactions' as status,
    day,
    total
    from tb3
    Run a query to Download Data