Query editor
WITH monthly_traders AS (SELECTDATE_TRUNC('week', block_date) AS time,project,maker AS userFROMdex.tradesWHEREblock_date > NOW() - INTERVAL '3' yearAND project = 'uniswap'UNIONSELECTDATE_TRUNC('week', block_date) AS time,project,taker AS userFROMdex.tradesWHEREblock_date > NOW() - INTERVAL '3' yearAND project = 'uniswap'),monthly_volume AS (SELECTproject,DATE_TRUNC('week', block_time) AS month,SUM(CAST(amount_usd AS DOUBLE)) AS usd_volumeFROMdex.trades AS tWHEREblock_time > NOW() - INTERVAL '3' yearAND project = 'uniswap'GROUP BY1, 2)SELECTmv.month,mv.project,COUNT(DISTINCT mt.user) AS traders,mv.usd_volume / COUNT(DISTINCT mt.user) AS average_volume_per_traderFROMmonthly_volume AS mvJOIN monthly_traders AS mt ON mv.month = mt.time AND mv.project = mt.projectGROUP BY1, 2, mv.usd_volumeORDER BY1 ASC