Query editor
with total as(select date_trunc('month', block_time) as block_month,'join' as joinkey,sum(amount_usd) as total_volumefrom dex.tradeswhere project = 'xchange'and block_date >= timestamp '2023-06-01'group by date_trunc('month', block_time), 'join'),since_live as (select 'join' as joinkey, sum(amount_usd) as live_volfrom dex.tradeswhere project = 'xchange'and block_date >= timestamp '2023-06-01'group by 'join'),chain as(select date_trunc('month', block_time) as block_month,blockchain,sum(amount_usd) as volumefrom dex.tradeswhere project = 'xchange'and block_date >= timestamp '2023-06-01'group by date_trunc('month', block_time), blockchain)select c.*, total_volume, volume/total_volume*100 as pct_of_volume, live_volfrom chain cinner join total t on c.block_month=t.block_monthinner join since_live l on t.joinkey=l.joinkey