select
date_trunc('month', date)::date as month,
protocol,
avg(fees) as fee_usd,
sum(fee_usd) over (partition by protocol order by month) as cumulative_fee
from external.defillama.fact_protocol_fees_revenue
where protocol in ('sushiswap', 'curve', 'uniswap', 'dodo', 'balancer')
group by 1, 2
order by 1, 2