select dt, count(*) as dau, round(sum(if (dt = first_in_time, 1, 0)) / count(*), 2) as uv_new_ratio from ( select uid, dt, min(dt) over ( partition by uid ) as first_in_time from ...