adriaparcerisasdau aptos 2.3
    Updated 2024-12-13
    -- forked from dau aptos 2 @ https://flipsidecrypto.xyz/studio/queries/46ead731-5454-4d3c-9cc1-5b95057f24c9


    WITH
    news as (
    SELECT
    distinct sender,
    min(trunc(block_timestamp,'week')) as debut
    from aptos.core.fact_transactions
    group by 1
    ),
    daus as (
    SELECT
    distinct sender as users,
    trunc(block_timestamp,'week') as weeks,
    count(distinct trunc(block_timestamp,'day')) as active_days
    from aptos.core.fact_transactions
    group by 1,2
    having active_days>=4
    ),
    active_users as (
    SELECT
    debut as date,
    case when sender in (select users from daus) then 'DAU'
    else 'No DAU' end as type,
    count(distinct sender) as n_userss
    from news
    group by 1,2
    )
    select date, type, n_userss as n_users, sum(n_users) over (order by date) as total_users from active_users
    where date>=current_date-interval '{{Months}} MONTHS' and date<trunc(current_date,'week') order by 1 asc


    QueryRunArchived: QueryRun has been archived