rajsRetention of Developers Weekly
    Updated 2023-01-25
    with new_developers as
    (
    SELECT
    author,
    datediff('week', '2018-01-01', min(date_trunc('week', updatedat))) as joined_month
    from near.beta.github_activity
    group by 1
    )
    ,

    active_developers as
    (
    SELECT
    author,
    datediff('week', '2018-01-01', date_trunc('week', updatedat)) as active_month
    from near.beta.github_activity
    group by 1,2
    )
    ,

    combined AS
    (
    SELECT
    a.author as author,
    active_month,
    joined_month
    from active_developers a
    left join new_developers n
    on a.author = n.author
    )
    ,

    reqd_table as
    (
    SELECT
    active_month - joined_month as period,
    Run a query to Download Data