Updated 2023-05-27
    -- forked from 02 @ https://flipsidecrypto.xyz/edit/queries/476d368e-4f5a-4b8c-bf32-996e2bcd6761

    -- forked from 01 @ https://flipsidecrypto.xyz/edit/queries/9ca44268-9d38-4372-86b0-d145ddd26dd3

    with

    ava_price AS
    (
    SELECT
    date_trunc( 'day' , a.hour ) AS day
    , avg( a.price ) AS price_usd
    FROM
    avalanche.core.fact_hourly_token_prices a
    WHERE
    a.symbol = 'WAVAX'
    GROUP BY
    1
    ORDER BY
    1 DESC
    )

    SELECT
    date_trunc( 'month' , a.block_timestamp ) AS date

    , count( DISTINCT a.from_address ) AS users
    , lag( users , 1 ) over ( ORDER BY date ) AS lags
    , users - lags AS change
    , cast(round(( change / lags ) * 100 , 2 ) as decimal(18,2)) AS growth

    --- Growth text ---
    , CASE when growth < 0 then 'Decrease ( % )' ELSE 'Increase ( % ) ' END AS " Growth "


    FROM
    avalanche.core.fact_transactions a
    JOIN
    Run a query to Download Data