With withdrawal_count as (
SELECT
DATE_TRUNC('DAY', SLOT_TIMESTAMP) AS day,
COUNT(*) AS number_of_withdrawals
FROM
ethereum.beacon_chain.fact_withdrawals
GROUP BY
day
ORDER BY
day
)
select *,
SUM(number_of_withdrawals) OVER (ORDER BY day) AS cumulative_withdrawal_count
from withdrawal_count
order by day desc;