Query editor
with total as (SELECTDATE_TRUNC('month', block_time) AS month,SUM(amount_usd) AS volume,COUNT(distinct tx_from) AS trader,COUNT(tx_from) AS tx_countFROMdex."trades"WHEREblockchain='ethereum'GROUP BY 1),direct as (SELECTDATE_TRUNC('month', block_time) AS month,SUM(amount_usd) AS volume,COUNT(distinct tx_from) AS trader,COUNT(tx_from) AS tx_countFROMdex."trades"WHEREblockchain='ethereum'ANDtx_hash NOT IN (SELECT tx_hashFROM dex_aggregator.tradesWHEREblockchain = 'ethereum')GROUP BY 1),agg as (SELECTDATE_TRUNC('month', block_time) AS month,SUM(amount_usd) AS volume,COUNT(distinct tx_from) AS trader,COUNT(tx_from) AS tx_countFROMdex_aggregator.tradesWHEREtx_hash NOT IN (SELECT tx_hashFROM dex_aggregator.tradesWHERE amount_usd>1000000000) ANDblockchain = 'ethereum'GROUP BY 1)SELECT total.month,total.volume as total_volume, total.trader as total_users,direct.volume as direct_dex_vol, direct.trader as direct_dex_users,agg.volume as agg_volume, agg.trader as agg_users,(total.volume - direct.volume) as agg_volume1, (total.trader - direct.trader) as agg_users1FROM totalLEFT JOIN direct ONtotal.month=direct.monthLEFT JOIN agg ONtotal.month=agg.month