0xHaM-dTime based Cohort Wide(%) copy
    Updated 2025-03-20
    -- forked from Stablejack - Time based Cohort Wide(%) @ https://flipsidecrypto.xyz/studio/queries/9b1a0527-179f-4a47-a1ae-477d641d2d6f

    -- forked from NEAR - Time based Cohort Wide(%) @ https://flipsidecrypto.xyz/studio/queries/bf631bf6-e030-4f06-881b-8edf5fbbe8b3

    with mainTb as (
    SELECT
    BLOCK_TIMESTAMP,
    TX_HASH,
    FROM_ADDRESS,
    FROM ronin.core.fact_transactions
    WHERE TO_ADDRESS in (
    '0x9d3936dbd9a794ee31ef9f13814233d435bd806c'
    ,'0x32950db2a7164ae833121501c797d79e7b79d74c'
    ,'0x05b0bb3c1c320b280501b86706c3551995bc8571'
    ,'0x3e0674b1ddc84b0cfd9d773bb2ce23fe8f445de3'
    )
    )
    , base_table as ( -- this is data prep
    select
    FROM_ADDRESS as address
    , date_trunc('month', block_timestamp) as date
    , min(date_trunc('month', block_timestamp)) over(partition by address) as earliest_date
    , datediff(
    'month'
    , min(date_trunc('month', block_timestamp)) over(partition by address) -- earliest_date
    , date_trunc('month', block_timestamp) -- current date in month
    ) as difference
    from mainTb
    where block_timestamp >= current_timestamp() - interval '{{Past_Months}} MONTH'
    HAVING date_trunc('month', block_timestamp) < date_trunc('month', current_date())
    )

    , count_new_users as(
    select
    earliest_date
    , count(distinct address) as new_users
    Last run: 15 days ago
    EARLIEST_DATE
    NEW_USERS
    ONE_MONTH_LATER
    TWO_MONTH_LATER
    THREE_MONTH_LATER
    FOUR_MONTH_LATER
    1
    2024-10 156,40682.00%80.00%75.00%68.00%
    2
    2024-11 53,87252.00%41.00%36.00%
    3
    2024-12 57,21946.00%34.00%
    4
    2025-01 48,87250.00%
    5
    2025-02 34,809
    5
    296B
    9s