jackguy100 - 100 - 100
    Updated 2023-02-20
    SELECT
    *,
    sum(new_users) over (partition by day_type ORDER BY day) as total_users
    FROM (
    SELECT
    first_day as day,
    'first day' as day_type,
    count(*) as new_users

    FROM (
    SELECT
    RECEIVER,
    min(date_trunc('week', block_timestamp)) as first_day,
    min(CASE WHEN PROJECT_NAME LIKE 'MARS' THEN date_trunc('week', block_timestamp) END) as first_matic
    FROM osmosis.core.fact_transfers
    LEFT outer JOIN osmosis.core.dim_tokens
    on currency LIKE address
    GROUP BY 1
    HAVING NOT FIRST_MATIC is NULL
    ) GROUP BY 1,2

    UNION

    SELECT
    first_token as day,
    'first MARS day' as day_type,
    count(*) as new_users

    FROM (
    SELECT
    RECEIVER,
    min(date_trunc('week', block_timestamp)) as first_day,
    min(CASE WHEN PROJECT_NAME LIKE 'MARS' THEN date_trunc('week', block_timestamp) END) as first_token
    FROM osmosis.core.fact_transfers
    LEFT outer JOIN osmosis.core.dim_tokens
    on currency LIKE address
    Run a query to Download Data