adriaparcerisasneari retained users
    Updated 2025-03-02
    WITH user_activity AS (
    SELECT
    owner_id,
    DATE_TRUNC('week', block_timestamp) as week,
    COUNT(DISTINCT tx_hash) as weekly_actions
    FROM near.defi.fact_intents
    GROUP BY 1, 2
    ),
    retention_metrics AS (
    SELECT
    ua.week,
    COUNT(DISTINCT CASE WHEN next.owner_id IS NOT NULL THEN ua.owner_id END) as retained_users,
    COUNT(DISTINCT ua.owner_id) as total_users,
    ROUND(100.0 * COUNT(DISTINCT CASE WHEN next.owner_id IS NOT NULL THEN ua.owner_id END) /
    NULLIF(COUNT(DISTINCT ua.owner_id), 0), 2) as retention_rate
    FROM user_activity ua
    LEFT JOIN user_activity next
    ON ua.owner_id = next.owner_id
    AND DATEDIFF('week', ua.week, next.week) = 1
    GROUP BY 1
    ORDER BY 1
    )
    SELECT * FROM retention_metrics where week<trunc(current_date,'week') order by 1 desc
    Last run: 3 months ago
    WEEK
    RETAINED_USERS
    TOTAL_USERS
    RETENTION_RATE
    1
    2025-02-24 00:00:00.00082443.28
    2
    2025-02-17 00:00:00.0007523432.05
    3
    2025-02-10 00:00:00.0006726325.48
    4
    2025-02-03 00:00:00.0006523927.2
    5
    2025-01-27 00:00:00.0005018626.88
    6
    2025-01-20 00:00:00.0005925523.14
    7
    2025-01-13 00:00:00.0007226327.38
    8
    2025-01-06 00:00:00.0004815032
    9
    2024-12-30 00:00:00.0004117223.84
    10
    2024-12-23 00:00:00.0003419417.53
    11
    2024-12-16 00:00:00.0003822616.81
    12
    2024-12-09 00:00:00.0003816722.75
    13
    2024-12-02 00:00:00.000269926.26
    14
    2024-11-25 00:00:00.000206132.79
    15
    2024-11-18 00:00:00.000156921.74
    16
    2024-11-11 00:00:00.000134330.23
    17
    2024-11-04 00:00:00.000113036.67
    17
    687B
    1s