SELECT
*,
sum(new_users) over (ORDER by min_day) as cume_users
FROM (
SELECT
min_day,
count(*) as new_users
FROM (
SELECT
tx_from,
min(date_trunc('day', BLOCK_TIMESTAMP)) as min_day
FROM osmosis.core.fact_transactions
GROUP by 1
)
GROUP BY 1
)
ORDER BY 1 DESC
-- credits to jack