misaghlbFLOW User Retention vs Other Chains - ethereum
    Updated 2023-02-27
    with users as (
    SELECT date_trunc('month', BLOCK_TIMESTAMP) as cohort_month, FROM_ADDRESS as user
    from ethereum.core.fact_transactions
    where cohort_month >= '2022-05-01'
    GROUP BY cohort_month, user
    ),
    total_users as (
    SELECT cohort_month as tcohort_month, COUNT(DISTINCT user) as total_users_count from users
    GROUP BY tcohort_month
    ),
    agg_data as (
    SELECT
    cohort_month,
    date_trunc('month', BLOCK_TIMESTAMP) as date,
    COUNT(DISTINCT FROM_ADDRESS) as retained_users,
    avg(total_users_count) as total_users_count2,
    retained_users/total_users_count2 * 100 as perc,
    row_number() over (partition by cohort_month order by date ASC) as ord
    from ethereum.core.fact_transactions
    join users u on user = FROM_ADDRESS and date_trunc('month', BLOCK_TIMESTAMP) > cohort_month
    join total_users tu on tcohort_month = cohort_month

    -- join users on cohort_month = date_trunc('month", BLOCK_TIMESTAMP)
    -- where FROM_ADDRESS in (SELECT user from users)
    where date >= to_date('2022-05-01')
    GROUP by cohort_month, date
    ORDER BY (cohort_month, date) ASC
    ),
    all_data as (
    select
    cohort_month, total_users_count2,
    "1" as "1 Month", "2" as "2 Month",
    "3" as "3 Month", "4" as "4 Month",
    "5" as "5 Month", "6" as "6 Month",
    "7" as "7 Month", "8" as "8 Month",
    "9" as "9 Month", "10" as "10 Month",
    Run a query to Download Data