select
chain,
sum(volume) as cumulative_vol,
sum(cumulative_vol) over (order by chain asc) total_vol
from
external.defillama.fact_dex_volume
where
1=1
and chain in ('avalanche','arbitrum')
and protocol in (
'joe v2.1','joe v2'--,'trader joe dex'
)
group by
chain
order by
chain desc