select
date_trunc('day', block_timestamp) as dates,
count (distinct tx_hash) as contract,
sum(contract) over (order by dates) as cum_new_contracts,
case when dates < '2022-06-01' then 'old' ELSE 'new' END as split
from
near.core.fact_actions_events
where
Action_Name = 'CreateAccount'
and date_trunc('day', block_timestamp) >= '2022-01-01'
group by
1