Updated 2022-03-04
    WITH transactions AS (SELECT
    DATE_TRUNC('week',block_timestamp) AS "WEEK",
    from_address AS "Address"
    FROM mdao_harmony.transfers

    UNION

    SELECT
    DATE_TRUNC('week',block_timestamp) AS "WEEK",
    to_address AS "Address"
    FROM mdao_harmony.transfers
    ),
    by_date AS(SELECT
    "WEEK",
    COUNT(distinct "WEEK"|| "Address") AS "# of Active Wallets"
    FROM transactions
    GROUP BY "WEEK"
    ORDER BY "WEEK" DESC
    )
    SELECT
    "WEEK",
    "# of Active Wallets",
    ("# of Active Wallets" - LAG("# of Active Wallets",1) OVER (ORDER BY "WEEK")) / LAG("# of Active Wallets",1) OVER (ORDER BY "WEEK") AS "Percent Change"
    FROM by_date AS b
    ORDER BY "WEEK" DESC

    Run a query to Download Data