with t as
(select e.block_timestamp as date_time,
receiver_id as receiver,
row_number() over (partition by receiver_id order by e.block_timestamp asc) as num_r
from near.core.fact_actions_events e join near.core.fact_receipts f on f.tx_hash = e.tx_hash
where date_trunc('Month', e.block_timestamp) >= '2022-01-01' and date_trunc('Month', e.block_timestamp) <= '2022-07-31' and action_name ilike '%DEPLOYCONTRACT%'
group by receiver, date_time
qualify num_r = 1)
select date_trunc('Month', date_time) as date,
count(distinct receiver) as count_contracts,
sum(count_contracts) over(order by date asc) as count_contracts_Comulative
from t group by date order by date asc