Query editor
withlz_summary as (selectuser_address as ua,count(*) as tc,min(block_time) as ibt,max(block_time) as lbt,date_diff('day', min(block_time), now()) as age,count(distinct source_chain_id) as sc,count(distinct destination_chain_id) as dc,count(distinct transaction_contract) as cc,count(distinct date_trunc('day', block_time)) as days,count(distinct date_trunc('week', block_time)) as weeks,count(distinct date_trunc('month', block_time)) as months,coalesce(sum(amount_usd), 0) as amtfrom layerzero.sendgroup by user_addressunion allselect0x00 as ua,0 as tc,now() as ibt,now() as lbt,0 as age,0 as sc,0 as dc,0 as cc,0 as days,0 as weeks,0 as months,0 as amt),summary_with_percentiles as (select*,percent_rank() over (order by tc) as tc_p,percent_rank() over (order by amt) as amt_p,percent_rank() over (order by sc) as sc_p,percent_rank() over (order by dc) as dc_p,percent_rank() over (order by cc) as cc_p,percent_rank() over (order by days) as days_p,percent_rank() over (order by weeks) as weeks_p,percent_rank() over (order by months) as months_p,percent_rank() over (order by age) as age_pfromlz_summary),distributed_users as (select*,pow(tc_p * amt_p * sc_p * dc_p * cc_p * days_p * weeks_p * months_p * age_p, 0.11111111111111) as rank_percentilefrom summary_with_percentiles)selectrow_number() over (order by rank_percentile desc) as rk,ua,cast(tc as varchar) || ' (top ' || format_number(ceiling((1 - tc_p) * 100)) || '%)' as tc,format_number(amt) || ' (top ' || format_number(ceiling((1 - amt_p) * 100)) || '%)' as amt,cast(sc as varchar) || ' / ' || cast(dc as varchar) || ' / ' || cast(cc as varchar)|| ' (top ' || format_number(ceiling((1 - sc_p) * 100)) || '% / '