select
*,
sum(percent) over (order by rounded_balance) as total_percent
from (
select
floor(balance, -2) as rounded_balance,
count(*) as number_of_addresses,
100 * ratio_to_report(number_of_addresses) over (order by rounded_balance desc) as percent
from algorand.account
where account_closed = 'FALSE'
and balance > 100
group by 1
)
order by rounded_balance