tomilayoperfect-gray
    Updated 2024-10-29
    WITH weekly_summary AS (
    SELECT
    DATE_TRUNC('week', block_timestamp) AS week_start_date,
    COUNT(DISTINCT tx_hash) AS transactions_per_week
    FROM
    blast.core.fact_transactions
    WHERE
    block_timestamp BETWEEN '2024-01-01' AND '2024-07-31'
    GROUP BY
    DATE_TRUNC('week', block_timestamp)
    ),
    accumulated_transactions AS (
    SELECT
    week_start_date,
    transactions_per_week,
    SUM(transactions_per_week) OVER (ORDER BY week_start_date) AS total_transactions_to_date
    FROM
    weekly_summary
    )
    SELECT
    week_start_date AS week,
    transactions_per_week AS weekly_transaction_count,
    total_transactions_to_date AS cumulative_transaction_count
    FROM
    accumulated_transactions
    ORDER BY
    week_start_date;

    QueryRunArchived: QueryRun has been archived