mattkstewNew Year, Wallets 3
    Updated 2023-01-05
    with tab1 as (
    select
    tx_sender,
    min(date_trunc('day', block_timestamp)) as date1

    from terra.core.fact_transactions
    group by 1
    )
    , tab2 as (
    select
    date1,
    count(*) as amount
    from tab1
    group by 1 )

    select
    date1,
    case when date1 >= '2023-01-01' then '2023'
    else '2022'
    END as Year_to_date,
    sum(amount) over (order by date1) as value
    from tab2
    where date1 > current_date - 60
    order by 1
    Run a query to Download Data