Query editor
with transfers as(select to as user, sum(cast(value / pow(10, 18) as decimal(18,3))) as amountfrom the_space_polygon.SpaceToken_evt_Transfergroup by 1union allselect "from" as user, -sum(cast(value / pow(10, 18) as decimal(18,3))) as amountfrom the_space_polygon.SpaceToken_evt_Transfergroup by 1), summary as(select user, sum(amount) as hold_amountfrom transfersgroup by 1having sum(amount) > 0), all_data as(select case when hold_amount < 10 then 'below 10'when hold_amount >= 10 and hold_amount < 100 then '10-100'when hold_amount >= 100 and hold_amount < 1000 then '100-1k'when hold_amount >= 1000 and hold_amount < 10000 then '1k-10k'when hold_amount >= 10000 and hold_amount < 100000 then '10k-100k'when hold_amount >= 100000 and hold_amount < 1000000 then '100k-1m'when hold_amount >= 1000000 and hold_amount < 10000000 then '1m-10m'when hold_amount >= 10000000 then 'above 10m'end as distfrom summary)select dist, count(dist) as count_distfrom all_datagroup by 1