keshanOther wallet distribution
    Updated 2022-02-06
    with active_users as (select event_attributes:"sender" as address from terra.msg_events where date_trunc('day', block_timestamp) >= date_trunc('day', CURRENT_DATE) - 90
    and event_attributes:"sender" is not null
    union
    select event_attributes:"from" from terra.msg_events where date_trunc('day', block_timestamp) >= date_trunc('day', CURRENT_DATE) - 90
    and event_attributes:"from" is not null
    )
    select count(distinct terra.daily_balances.address) as wallets,
    case when balance = 0 then '0 LUNA'
    when balance > 0 and balance <= 1 then '1 or less'
    when balance > 1 and balance <= 10 then '1 to 10'
    when balance > 10 and balance <= 100 then '10 to 100'
    when balance > 100 and balance <= 1000 then '100 to 1000'
    when balance > 1000 and balance <= 10000 then '1000 to 10K'
    when balance > 10000 and balance <= 1000000 then '10K to 1M'
    when balance > 1000000 then '1M+ LUNA' end as groups
    from terra.daily_balances left join active_users on active_users.address = terra.daily_balances.address
    where lower(currency) = 'luna' and date_trunc('day', date) = CURRENT_DATE - 1
    and active_users.address is null
    group by groups

    Run a query to Download Data