0xHaM-dTerra - Weekly New User Changes
    Updated 2024-01-04
    with
    terra_new_user as (
    select
    tx_sender,
    min(block_timestamp) as first_transactions_timestamp
    from terra.core.fact_transactions
    where TX_SUCCEEDED = 'true'
    group by tx_sender
    )

    select
    date_trunc('week', first_transactions_timestamp) as "Date",
    count(distinct tx_sender) as "New User Count",
    sum("New User Count") over (order by "Date") as "New User Growth Trends",
    count(distinct tx_sender) - lag(count(distinct tx_sender)) over (order by "Date") as "Weekly Change",
    case
    when "Weekly Change" > 0 then 'Increase'
    when "Weekly Change" < 0 then 'Decrease'
    else 'Unchanged'
    end as "Status"
    from terra_new_user
    WHERE year("Date") = '2023'
    group by "Date"
    having "Date" is not null
    order by "Date", "Status"


    QueryRunArchived: QueryRun has been archived