binhachon16. Algorand Assets Using Account Asset Table - Opulous distribution adjusted
    Updated 2022-01-31
    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 = 287867876
    and asset_closed = 'FALSE'
    and frozen = 'FALSE'
    and amount > 0
    group by rounded_amount
    ),
    final_table as (
    select
    rounded_amount,
    total,
    100 * sum(total) over (order by rounded_amount) / sum(total) over () as total_percentile,
    frequency as number_of_wallets,
    100 * sum(frequency) over (order by rounded_amount) / sum(frequency) over () as frequency_percentile
    from asset_histogram
    )
    select * from final_table
    where frequency_percentile < 80


    Run a query to Download Data