Query editor
withdate_users as (selectdate_trunc('month', block_time) as month,trader_id user_address,project project_from dex_solana.tradeswhere 1=1and (token_bought_mint_address = 'MEFNBXixkEbait3xn9bkm8WsJzXtVsaJEn4c8Sam21u' ortoken_sold_mint_address = 'MEFNBXixkEbait3xn9bkm8WsJzXtVsaJEn4c8Sam21u')group by 1, 2, 3),get_first_activity as (selectuser_address,project_,min(month) as start_monthfrom date_usersgroup by 1, 2),new_user_count as (selectstart_month,project_,count(distinct user_address) as new_usersfrom get_first_activitygroup by 1, 2),get_returning_users as (with get_active_months as (selectb.start_month,a.month as active_month,a.project_,count(distinct a.user_address) as returning_usersfrom date_users ajoin get_first_activity bon a.user_address = b.user_addressand a.project_ = b.project_group by 1, 2, 3)selectstart_month,active_month,project_,returning_users,row_number() over (partition by start_month, project_ order by active_month) as months_after