forgashflow stats: weekly active users copy
    Updated 2024-05-30
    -- forked from adriaparcerisas / flow stats: weekly active users @ https://flipsidecrypto.xyz/adriaparcerisas/q/MzwH_ymY7_d2/flow-stats-weekly-active-users
    with news as (
    SELECT
    distinct authorizers [0] as users,
    min(trunc(block_timestamp, 'week')) as debut
    from
    flow.core.fact_transactions
    group by
    1
    ),
    news2 as (
    select
    distinct debut,
    count(distinct users) as new_users
    from
    news
    group by
    1
    ),
    actives as (
    SELECT
    trunc(block_timestamp, 'week') as week,
    count(distinct authorizers [0]) as active_users
    from
    flow.core.fact_transactions x
    group by
    1
    order by
    1 desc
    ),
    final as (
    select
    week,
    active_users,
    new_users,
    sum(new_users) over (
    QueryRunArchived: QueryRun has been archived