Gunakan MIN()
sebagai fungsi jendela:
select t.*,
(case when col2 < add_months(min(col2) over (partition by col1), 3)
then col3
end) as imputed_col3
from t;
Catatan:Jika col2
bukan tanggal, Anda dapat mengonversinya:
select t.*,
(case when to_date(col2, 'YYYYMM') < add_months(min(to_date(col2, 'YYYYMM')) over (partition by col1), 3)
then col3
end) as imputed_col3
from t;