messariaptos dapa q
    Updated 2024-04-24
    WITH ActiveDaysCTE AS (
    SELECT
    sender,
    COUNT(DISTINCT date(block_timestamp)) AS active_days
    FROM
    aptos.core.fact_transactions
    WHERE
    date(block_timestamp) BETWEEN '2024-01-01' AND '2024-03-31'
    GROUP BY
    sender
    )

    SELECT
    SUM(active_days * count_active_days) / SUM(count_active_days) AS weighted_average
    FROM (
    SELECT
    active_days,
    COUNT(active_days) AS count_active_days
    FROM
    ActiveDaysCTE
    GROUP BY
    active_days
    ) AS InnerQuery
    QueryRunArchived: QueryRun has been archived