Query editor
WITH defi_balances AS (SELECTdepositor,SUM(CASEWHEN transaction_type = 'deposit' THEN amount_usdWHEN transaction_type = 'withdraw' THEN -amount_usdELSE 0END) as total_balance_usdFROM lending.supplyWHERE blockchain = 'ethereum'AND block_time >= TIMESTAMP '2020-01-01'GROUP BY depositor)SELECTdepositor,total_balance_usdFROM defi_balancesWHERE total_balance_usd > 1000000ORDER BY total_balance_usd DESC