misaghlbTerradash Part 1: Activity - trx
    Updated 2023-04-13
    with users_monthly as (
    select date_trunc('week', BLOCK_TIMESTAMP) as block_date,
    count(distinct TX_SENDER) as active_users_count
    from terra.core.fact_transactions
    group by 1
    order by 1
    ),

    users_monthly_change as (
    select block_date,
    active_users_count,
    (active_users_count - lag(active_users_count, 1) over (order by block_date)) / (lag(active_users_count, 1) over (order by block_date)) as change_rate
    from users_monthly
    order by block_date
    )

    select block_date,
    active_users_count,
    (case when change_rate > 50 then 50 else change_rate end) as change_rate -- Do some normalize
    from users_monthly_change
    order by block_date
    Run a query to Download Data