Query editor
WITH participants AS (SELECT * FROM "query_8094637"), totals AS (SELECTCOUNT(*) AS participant_count,SUM(allocation_xpl) AS allocated_xpl,SUM(sale_funded_usd) AS sale_funded_usdFROM participants)SELECTp.inferred_category AS category,COUNT(*) AS participant_count,SUM(p.allocation_xpl) AS allocated_xpl,SUM(p.sale_funded_usd) AS sale_funded_usd,100 * SUM(p.allocation_xpl) / t.allocated_xpl AS allocation_share_pct,100 * COUNT(*) / CAST(t.participant_count AS DOUBLE) AS participant_share_pct,MIN(p.unlock_date) AS unlock_dateFROM participants pCROSS JOIN totals tGROUP BY 1, t.allocated_xpl, t.participant_countORDER BY CASE p.inferred_category WHEN 'US' THEN 1 WHEN 'non-US' THEN 2 ELSE 3 END