winnie-fsAptos Base - [chain] account first time transaction
    Updated 2023-11-22
    with

    asdedafdsdfasdfswe as (

    select

    block_timestamp
    , address
    , version
    -- , change_data

    from aptos.core.fact_changes
    inner join aptos.core.fact_transactions
    using(block_timestamp, version, success)
    where tx_type = 'user_transaction'
    and change_type = 'write_resource'
    and change_module = 'account'
    and change_data :sequence_number ::int = 1
    and address = sender
    and block_timestamp ::date > current_date() - interval '{{days}} days' - interval '7 days'
    )

    select

    date_trunc('{{date_trunc}}', block_timestamp) as date
    , count(distinct address) as accounts
    , avg(accounts) over (order by date rows between 6 preceding and current row) as "7D Avg."

    from asdedafdswe
    group by 1
    qualify date > current_date() - interval '{{days}} days'


    Run a query to Download Data