Query editor
WITH wallet_first_txn AS (SELECT"from" AS wallet,MIN(DATE_TRUNC('day', block_time)) AS dayFROMblast.transactionsGROUP BY 1),all_new_wallets AS (SELECTday,COUNT(wallet) AS new_walletsFROMwallet_first_txnGROUP BY 1),all_active_wallets AS (SELECTDATE_TRUNC('day', block_time) AS day,COUNT(DISTINCT "from") AS active_wallets,COUNT(*) AS transactionsFROMblast.transactionsGROUP BY 1),categorized_wallets AS (SELECTaw.day,active_wallets,transactions,AVG(transactions) OVER(ORDER BY aw.day ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) AS MA_7_days,COALESCE(new_wallets, 0) AS new_wallets,active_wallets - COALESCE(new_wallets, 0) AS returning_wallets,CASE WHENLAG(new_wallets, 1) OVER (ORDER BY nw.day) IS NULL OR LAG(new_wallets, 1) OVER (ORDER BY nw.day) = 0 THEN NULLELSE (new_wallets - LAG(new_wallets, 1) OVER (ORDER BY nw.day)) * 100.0 / LAG(new_wallets, 1) OVER (ORDER BY nw.day)END AS new_users_growth_rateFROMall_active_wallets AS awLEFT JOINall_new_wallets nw ON aw.day = nw.day)SELECT*FROMcategorized_walletsWHEREday >= now() - interval '1' yearORDER BY 1 DESC