rackhaelNEAR SOCIAL 5 - MOM Growth
    Updated 2023-06-30
    WITH
    monthly_counts AS (
    SELECT
    DATE_TRUNC('month', block_timestamp) AS month,
    MIN(block_timestamp) AS min_block_timestamp,
    COUNT(DISTINCT signer_id) AS unique_users,
    COUNT(DISTINCT tx_hash) AS transactions
    FROM
    near.social.fact_decoded_actions
    GROUP BY
    month
    ORDER BY
    month
    )
    SELECT
    month,
    unique_users,
    transactions,
    (
    unique_users - LAG(unique_users) OVER (
    ORDER BY
    month
    )
    ) AS user_growth,
    (
    transactions - LAG(transactions) OVER (
    ORDER BY
    month
    )
    ) AS transaction_growth,
    ROUND(
    (
    (
    unique_users - LAG(unique_users) OVER (
    ORDER BY
    month
    Run a query to Download Data