Query editor
with trade_summary as (select block_date,count(distinct taker) as active_user_count,sum(amount_usd) as trade_amountfrom dex.tradeswhere blockchain = 'ethereum'and block_date >= date('2020-01-01')group by 1order by 1),user_initial_trade as (select taker,min(block_date) as initial_trade_datefrom dex.tradeswhere blockchain = 'ethereum'and block_date >= date('2020-01-01')group by 1),new_user_summary as (select initial_trade_date,count(taker) as new_user_countfrom user_initial_tradegroup by 1order by 1)select t.block_date,active_user_count,new_user_count,active_user_count - new_user_count as existing_user_count,trade_amountfrom trade_summary tleft join new_user_summary u on t.block_date = u.initial_trade_dateorder by t.block_date