Query editor
WITH wallet_first_interaction AS (SELECTtrader_id AS wallet,MIN(block_time) AS first_interaction_time,MIN_BY(project, block_time) AS first_dex,MIN_BY(token_sold_symbol, block_time) AS first_token,MIN_BY(amount_usd, block_time) AS first_trade_size_usdFROM dex_solana.tradesWHERE block_time >= NOW() - INTERVAL '60' dayAND amount_usd > 0GROUP BY trader_id),new_wallet_attribution AS (SELECTDATE_TRUNC('day', first_interaction_time) AS day,COALESCE(first_dex, 'Unknown') AS entry_point,COALESCE(first_token, 'Unknown') AS first_token,COUNT(DISTINCT wallet) AS new_wallets,ROUND(AVG(first_trade_size_usd), 2) AS avg_first_trade_size_usdFROM wallet_first_interactionWHERE first_interaction_time >= NOW() - INTERVAL '30' dayGROUP BY 1, 2, 3)SELECTday,entry_point,first_token,new_wallets,ROUND(100.0 * new_wallets / SUM(new_wallets) OVER (PARTITION BY day), 2) AS daily_percent,avg_first_trade_size_usdFROM new_wallet_attributionORDER BY day DESC, new_wallets DESC;