Query editor
WITHmonthly_data AS (SELECTdate_trunc('month', evt_block_time) AS block_month,SUM(amount_usd) AS totalVolumeUSD,SUM(IF(blockchain = 'ethereum', amount_usd, 0)) AS ethereumVolumeUSD,SUM(IF(blockchain = 'bnb', amount_usd, 0)) AS bnbVolumeUSD,SUM(IF(blockchain = 'arbitrum', amount_usd, 0)) AS arbitrumVolumeUSD,SUM(IF(blockchain = 'polygon', amount_usd, 0)) AS polygonVolumeUSD,SUM(IF(type = 'Inflow', amount_usd, 0)) AS inflowVolumeUSD,SUM(IF(type = 'Outflow', amount_usd, 0)) AS outflowVolumeUSD,SUM(IF(type = 'Inflow', amount_usd, 0)) - SUM(IF(type = 'Outflow', amount_usd, 0)) AS netFlowUSD,SUM(fee_usd) AS feesUSD,SUM(IF(type = 'Inflow', fee_usd, 0)) AS inflowFeeVolumeUSD,SUM(IF(type = 'Outflow', fee_usd, 0)) AS outflowFeeVolumeUSD,COUNT(IF(type = 'Inflow', 1, NULL)) AS inflowTransfers,COUNT(IF(type = 'Outflow', 1, NULL)) AS outflowTransfers,SUM(IF(blockchain = 'ethereum'AND type = 'Inflow',amount_usd,0)) - SUM(IF(blockchain = 'ethereum'AND type = 'Outflow',amount_usd,0)) AS ethereumNetFlowUSD,SUM(IF(blockchain = 'bnb'AND type = 'Inflow',amount_usd,0)) - SUM(IF(blockchain = 'bnb'AND type = 'Outflow',amount_usd,0)) AS bnbNetFlowUSD,SUM(IF(blockchain = 'arbitrum'AND type = 'Inflow',amount_usd,0)) - SUM(IF(blockchain = 'arbitrum'AND type = 'Outflow',amount_usd,0