Updated 2023-05-27
    with flows as(
    SELECT
    date_trunc('week', block_timestamp)::date as date,
    tx_succeeded as f_succeed,
    count(DISTINCT sender) as f_users,
    count(DISTINCT tx_id) as f_transactions,
    avg(amount) as f_avg_price,
    sum(amount) as f_volume,
    f_users / f_transactions as f_tpu,
    f_users / f_volume as f_vpu
    from flow.core.ez_token_transfers
    where token_contract like '%FlowToken%'
    group by 1, 2
    ),
    tops as(
    SELECT
    date_trunc('week', block_timestamp)::date as date,
    tx_succeeded as t_succeed,
    count(DISTINCT sender) as t_users,
    count(DISTINCT tx_id) as t_transactions,
    avg(amount) as t_avg_price,
    sum(amount) as t_volume,
    t_users / t_transactions as t_tpu,
    t_users / t_volume as t_vpu
    from flow.core.ez_token_transfers
    where token_contract not like '%FlowToken%'--in ('A.4eded0de73020ca5.FazeUtilityCoin', 'A.cfdd90d4a00f7b5b.TeleportedTetherToken', 'A.3c5959b568896393.FUSD', 'A.0f9df91c9121c460.BloctoToken', 'A.348fe2042c8a70d8.MyToken')
    group by 1,2
    )
    SELECT
    x.date,
    f_users,
    sum(f_users)over(order by x.date) as cum_f_users,
    f_transactions,
    sum(f_transactions)over(order by x.date) as cum_f_transactions,
    f_volume,
    sum(f_volume)over(order by x.date) as cum_f_volume,
    Run a query to Download Data