select
round(sum(if(date=date_add(fv,interval 1 day),1,0))
/count(distinct a.user_id),3) as p
from
    (select
     user_id
    ,date
    ,first_value(date)over(partition by user_id order by date) fv
    from login) a;