with tab1 as (
SELECT
attributes:message:sender,
min(date_trunc('week', block_timestamp)) as Min_week
FROM terra.core.fact_messages
WHERE not message_value:msg:max_voting_period is NULL
GROUP BY 1
)
SELECT
*,
sum(new_users) over (order by min_week) as total_users
FROM (
SELECT
min_week,
count(*) as new_users
FROM tab1
GROUP BY 1--,2
)