Query editor
WITH users AS (SELECTdate_trunc('month', day) AS month,CAST(COUNT(DISTINCT user) FILTER (WHERE active = 1) AS DOUBLE) AS active_user,CAST(COUNT(DISTINCT user) FILTER (WHERE active_supply = 1) AS DOUBLE) AS supply_user,CAST(COUNT(DISTINCT user) FILTER (WHERE active_redeem = 1) AS DOUBLE) AS redeem_user,CAST(COUNT(DISTINCT user) FILTER (WHERE active_borrow = 1) AS DOUBLE) AS borrow_user,CAST(COUNT(DISTINCT user) FILTER (WHERE active_repay = 1) AS DOUBLE) AS repay_userFROM dune.xvslove_team.daily_user_statsWHERE day >= DATE '2025-01-01'GROUP BY 1),data AS (SELECTmonth AS day,'Venus Core' AS platform,active_user,supply_user,redeem_user,borrow_user,repay_userFROM usersUNION ALLSELECTdate_trunc('month', block_date) AS day,'Flux' AS platform,COUNT(DISTINCT CASEWHEN operation_type IN ('Supply','Supply_Collateral','Withdraw','Withdraw_Collateral','Borrow','Repay')THEN user END) AS active_user,COUNT(DISTINCT CASEWHEN operation_type IN ('Supply','Supply_Collateral')THEN user END) AS supply_user,COUNT(DISTINCT CASEWHEN operation_type IN ('Withdraw','Withdraw_Collateral')THEN user END) AS redeem_user,COUNT(DISTINCT CASEWHEN operation_type = 'Borrow'THEN user END) AS borrow_user,COUNT(DISTINCT CASEWHEN operation_type = 'Repay'THEN user END) AS repay_userFROM query_7323590GROUP BY 1)SELECT *FROM dataWHERE day < date_trunc('month', CURRENT_DATE)ORDER BY 1 DESC, platform;