Query editor
-- Dashboard entry point: runs on validated, frozen wallet-level source results.-- Rebuild instructions and raw source queries are in 5TraderRetention/12Month/README.md.-- Percentages are 0-100. Profit = estimated pre-fee P&L > $0.01 (rounding buffer).WITH wallet_snapshot AS (SELECT venue, wallet,TRY_CAST(entry_volume_usd AS double) AS entry_volume_usd,TRY_CAST(activity_mask AS double) AS activity_mask,TRY_CAST(m12_retained AS double) AS m12_retained,TRY_CAST(anniversary_retained AS double) AS anniversary_retained,TRY_CAST(continuous_m0_m12 AS double) AS continuous_m0_m12,TRY_CAST(pnl_eligible AS double) AS pnl_eligible,TRY_CAST(pnl_estimate_usd AS double) AS pnl_estimate_usd,TRY_CAST(unpriced_positions AS double) AS unpriced_positionsFROM dune.defiance_cr.dataset_trader_retention_12m_wallet_snapshot_20260905),segments AS (SELECT w.*, s.segmentFROM wallet_snapshot wCROSS JOIN (VALUES ('All entrant wallets', 0.0), ('January turnover >= $100', 100.0)) s(segment, minimum_turnover)WHERE coalesce(entry_volume_usd, 0) >= minimum_turnover)SELECT venue, segment,count(*) AS cohort_wallets,count_if(m12_retained = 1) AS retained_wallets,100.0 * count_if(m12_retained = 1) / count(*) AS retention_pct,count_if(anniversary_retained = 1) AS anniversary_retained_wallets,100.0 * count_if(anniversary_retained = 1) / count(*) AS anniversary_retention_pct,count_if(continuous_m0_m12 = 1) AS continuous_wallets,100.0 * count_if(continuous_m0_m12 = 1) / count(*) AS continuous_retention_pct,count_if(m12_retained = 1 AND pnl_eligible = 1) AS pnl_eligible_retained,count_if(m12_retained = 1 AND pnl_eligible = 1 AND pnl_estimate_usd > 0.01) AS profitable_retained,100.0 * count_if(m12_retained = 1 AND pnl_eligible = 1 AND pnl_estimate_usd > 0.01)/ nullif(count_if(m12_retained = 1 AND pnl_eligible = 1), 0) AS estimated_profitable_pct,100.0 * count_if(m12_retained = 1 AND pnl_eligible = 1 AND pnl_estimate_usd > 0.01)/ nullif(count_if(m12_retained = 1), 0) AS known_profitable_pct_all_retained,100.0 * count_if(m12_retained = 1 AND pnl_eligible = 1)/ nullif(count_if(m12_retained = 1), 0) AS pnl_basis_coverage_pct,100.0 * count_if(m12_retained = 1 AND pnl_eligible = 1 AND unpriced_positions > 0)/ nullif(count_if(m12_retained = 1 AND pnl_eligible = 1), 0) AS unpriced_holdings_pct,100.0 * count_if(m12_retained = 1 AND pnl_eligible = 1 AND (pnl_estimate_usd > 0.01 OR unpriced_positions > 0))/ nullif(count_if(m12_retained = 1 AND pnl_eligible = 1), 0) AS unpriced_inventory_profit_upper_bound_pct,approx_percentile(pnl_estimate_usd, 0.5) FILTER (WHERE m12_retained = 1 AND pnl_eligible = 1) AS median_retained_pnl_usd,100.0 * count_if(continuous_m0_m12 = 1 AND pnl_eligible = 1 AND pnl_estimate_usd > 0.01)/ nullif(count_if(continuous_m0_m12 = 1 AND pnl_eligible = 1), 0) AS estimated_profitable_continuous_pct,count_if(continuous_m0_m12 = 1 AND pnl_eligible = 1) AS pnl_eligible_continuous,100.0 * count_if(anniversary_retained = 1 AND pnl_eligible = 1 AND pnl_estimate_usd > 0.01)/ nullif(count_if(anniversary_retained = 1 AND pnl_eligible = 1), 0) AS estimated_profitable_anniversary_pct,count_if(anniversary_retained = 1 AND pnl_eligible = 1) AS pnl_eligible_anniversaryFROM segmentsGROUP BY 1, 2ORDER BY segment, venue