Query editor
with t1 as (select "from" as address,round(sum(value*1E-18),2) as amountfrom ethereum.transactionswhere to = 0xb867b86055144897954c3f37b07e60af029f525dgroup by "from"order by amount desc),t2 as (selectcase when amount < 0.6 then 1when amount >= 0.6 and amount < 0.9 then 2when amount >= 0.9 and amount < 1.2 then 3when amount >= 1.2 and amount < 1.5 then 4when amount >= 1.5 then 5 end as number_of_mintsfrom t1),t3 as (select count(number_of_mints) as total_walletsfrom t2),t4 as (select number_of_mints, count(number_of_mints) as cntfrom t2group by number_of_mintsorder by number_of_mints),t5 as (select *,4500 - total_wallets as raffle_amount,(number_of_mints-1)*cnt as extra_mintfrom t3 cross join t4),t6 as (select sum(extra_mint) as total_extra_mintfrom t5),t7 as (select *from t5 cross join t6)select *,raffle_amount*100/total_extra_mint as win_ratefrom t7order by number_of_mints