Query editor
with dai as (select date(block_date) as date,project,casewhen token_bought_symbol < token_sold_symbolthen token_bought_symbolelse token_sold_symbolend as token1,casewhen token_bought_symbol < token_sold_symbolthen token_sold_symbolelse token_bought_symbolend as token2,concat(casewhen token_bought_symbol < token_sold_symbolthen token_bought_symbolelse token_sold_symbolend,'-',casewhen token_bought_symbol < token_sold_symbolthen token_sold_symbolelse token_bought_symbolend) as pair,sum(amount_usd) as amount_usdfrom dex.tradeswhere token_sold_symbol like '%DAI%'or token_bought_symbol like '%DAI%'group by 1, 2, 3, 4 ,5having sum(amount_usd) > 1e6)select date_trunc('month', date) as date,project,token1,token2,pair,amount_usdfrom daiorder by 1 desc, 6 desc