with asset_histogram as (
select
round(amount/1e6, -2) as rounded_amount,
sum(amount/1e6) as total,
count(amount) as frequency
from algorand.account_asset
where asset_id = 300208676
and asset_closed = 'FALSE'
and frozen = 'FALSE'
and amount > 0
and amount/1e6 < 1e10
group by rounded_amount
)
select
rounded_amount,
total,
100 * sum(total) over (order by rounded_amount) / sum(total) over () as total_percentile,
frequency,
100 * sum(frequency) over (order by rounded_amount) / sum(frequency) over () as frequency_percentile
from asset_histogram