Updated 2023-05-27
    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
    count( DISTINCT date_trunc( 'month' , a.block_timestamp ) ) AS date

    , count( DISTINCT a.from_address ) AS users
    , count( DISTINCT a.tx_hash ) AS transactions
    , sum( a.tx_fee * c.price_usd ) AS fees

    , users / date AS avg_users
    , transactions / date AS avg_transactions
    , fees / date AS avg_fees

    FROM
    avalanche.core.fact_transactions a
    JOIN
    avalanche.core.dim_labels b
    ON a.to_address = b.address
    JOIN
    ava_price c
    ON date_trunc( 'day' , a.block_timestamp ) = c.day
    Run a query to Download Data