Query editor
with follow_data as (select f.follower, p.profile_idfrom (select from_hex(cast(json_extract(vars,'$.follower') as varchar)) as follower, -- cast to varbinarycast(json_extract(vars,'$.profileIds') as array(integer)) as profile_ids -- cast to arrayfrom lens_polygon.LensHub_call_followWithSigunion allselect t."from" as follower,cast(f.profileIds as array(integer)) as profile_idsfrom lens_polygon.LensHub_call_follow finner join polygon.transactions t on f.call_tx_hash = t.hashwhere call_block_time >= date('2022-05-18') -- Lens launch dateand block_time >= date('2022-05-18')and call_success = true) fcross join unnest(f.profile_ids) as p(profile_id)),following_summary as (select count(*) as total_following_count,count(distinct follower) as follower_address_count,count(distinct profile_id) as followed_profile_countfrom follow_data),top_followed_profiles as (select profile_id,count(follower) as follower_countfrom follow_datagroup by 1order by 2 desclimit 1000)select profile_id,follower_count,sum(follower_count) over () as top_profile_follower_count,total_following_count,follower_address_count,followed_profile_count,cast(sum(follower_count) over () as double) / total_following_count * 100 as top_profile_follower_ratiofrom top_followed_profilesinner join following_summary on trueorder by 2 desc