Query editor
WITH base_data AS (SELECTholder,"Total deposits" AS total_deposits,"Current active vaults" AS current_active_vaults,"Total active vaults" AS total_active_vaultsFROM dune.symbiotic.result_v_2_user_stats -- [V2] User stats),-- Compute averages and medianstats AS (SELECTAVG(total_deposits) AS avg_deposits_per_user,AVG(current_active_vaults) AS avg_active_vaults_per_user,approx_percentile(current_active_vaults, 0.5) AS median_active_vaults_per_user,SUM(current_active_vaults)/SUM(total_active_vaults) AS "wallet retention",NULL AS label,NULL AS user_count,NULL AS percentage_of_usersFROM base_data),vault_distribution AS (SELECTNULL AS avg_deposits_per_user,NULL AS avg_active_vaults_per_user,NULL AS median_active_vaults_per_user,NULL AS "wallet retention",CAST(current_active_vaults AS VARCHAR) || ' active vaults' AS label,COUNT(*) AS user_count,ROUND(100.0 * COUNT(*) / SUM(COUNT(*)) OVER (), 2) AS percentage_of_usersFROM base_dataGROUP BY current_active_vaults)SELECT * FROM statsUNION ALLSELECT * FROM vault_distributionORDER BY label NULLS FIRST;