Query editor
WITH daily_followers AS (SELECTDATE_TRUNC('day', timestamp) AS date,CASEWHEN target_fid = 193315 THEN '33bits'WHEN target_fid = 862100 THEN 'superanon'WHEN target_fid = 880094 THEN 'anoncast'END AS anon_account,COUNT(fid) AS new_followersFROM dune.neynar.dataset_farcaster_linksWHERE target_fid IN (880094, 862100, 193315)AND type = 'follow'GROUP BY 1, 2), all_days AS (SELECT DISTINCT DATE_TRUNC('day', timestamp) AS dateFROM dune.neynar.dataset_farcaster_links), daily_followers_with_zeros AS (SELECTall_days.date,accounts.anon_account,COALESCE(daily_followers.new_followers, 0) AS new_followersFROM all_daysCROSS JOIN (SELECT DISTINCT anon_account FROM daily_followers) AS accountsLEFT JOIN daily_followersON all_days.date = daily_followers.dateAND accounts.anon_account = daily_followers.anon_account), cumulative_followers AS (SELECTdate,anon_account,new_followers,CAST(SUM(new_followers) OVER (PARTITION BY anon_account ORDER BY date) AS INTEGER) AS cumulative_followersFROM daily_followers_with_zeros)SELECT *FROM cumulative_followersWHERE date >= TRY_CAST('2024-10-10' AS TIMESTAMP)ORDER BY date DESC