select date,
count(distinct case when first_day=date then user_id end) as new
from (
select user_id,
date,
min(date) over(partition by user_id ) as first_day
from login
) t
group by date
order by date;