StangFAST01 - average active users
    Updated 2023-07-28
    -- forked from 01 - chart @ https://flipsidecrypto.xyz/edit/queries/5db0c3a2-37c3-4de0-8b3b-8e4131f5a395
    with

    final AS
    (
    SELECT
    date_trunc( 'month' , a.block_timestamp ) AS "date"
    , count( DISTINCT a.tx_signer ) AS "active users"
    , sum( "active users" ) over ( ORDER BY "date" ASC ) AS "total active users"

    FROM
    near.core.fact_transactions a
    LEFT JOIN
    near.core.dim_address_labels b
    ON a.tx_receiver = b.address
    WHERE
    b.project_name IS NOT NULL
    AND a.tx_signer != a.tx_receiver
    AND "date" > dateadd( 'month', -{{month}} , current_date )
    GROUP BY 1
    ORDER BY 1 DESC
    )
    SELECT
    sum( "active users" ) AS total_active_users
    , avg( "active users" ) AS avg_active_users
    FROM
    final


    Run a query to Download Data