efer6. Event Types - 2
    Updated 2023-04-13
    WITH result AS (
    SELECT
    DATE_TRUNC('month', BLOCK_TIMESTAMP) AS date_month,
    EVENT_TYPE AS event,
    COUNT(*) AS txns
    FROM flow.core.fact_events
    WHERE BLOCK_TIMESTAMP >= '2022-01-01'
    GROUP BY event, date_month
    )

    select * from (
    SELECT
    event,
    txns,
    date_month,
    MONTHNAME(date_month),
    row_number () over (partition by date_month order by txns desc) rn
    FROM result) v
    where rn <= {{TOP_n}}
    order by date_month, txns desc
    Run a query to Download Data