Sandeshterra weekly active users
    Updated 2023-04-13
    with a as
    (
    select tx_sender,date_trunc('week',block_timestamp) as w, count( distinct date_trunc('day',block_timestamp)) as active_days from terra.core.fact_transactions
    -- where tx_sender in ('terra1m4hq3r4xacwam3zk40kh0892gwlfzdpcxafd7u','terra18vnrzlzm2c4xfsx382pj2xndqtt00rvhu24sqe','terra1phlncd6sm9xc8sd2hfqn7x5pakad6stuu8yrs9')
    group by 1,2
    having active_days > 3
    order by 2,3 desc
    ),
    total_users AS
    (
    select date_trunc('week',block_timestamp) as d, count(distinct tx_sender) as all_users from terra.core.fact_transactions
    group by d
    ), active as
    ( select date_trunc('week',w) as date , count(distinct tx_sender) as active_users from a
    group by date order by date asc )
    select a.*,tu.all_users from active a inner join total_users tu
    on tu.d=a.date
    -- limit 10
    Run a query to Download Data