Query editor
WITH monthly_pool_fees AS (SELECT DATE_TRUNC('month', day) AS "month",ticker,pool,pool_address,SUM(total_pool_fees) AS total_pool_feesFROM query_5956224GROUP BY 1,2,3,4ORDER BY "month" DESC, total_pool_fees DESC)SELECT *,SUM(total_pool_fees) OVER (PARTITION BY "month" ORDER BY total_pool_fees) AS monthly_protocol_fees,SUM(total_pool_fees) OVER (ORDER BY "month") AS protocol_cumulative_feesFROM monthly_pool_feesORDER BY "month" DESC, total_pool_fees DESC