Вы можете переписать его, используя две вложенные функции:
SELECT ...
ROW_NUMBER()
OVER (PARTITION BY acct_id, new_part -- add new_part to the existing partition
ORDER BY snap_dt
ROWS UNBOUNDED PRECEDING)
FROM
(
SELECT -- returns the same value for all rows within a group
SUM(CASE WHEN reset_flag = 1 THEN 1 ELSE 0 END)
OVER (PARTITION BY acct_id
ORDER BY snap_dt
ROWS UNBOUNDED PRECEDING) AS new_part
...
) AS dt