Столбцы, вычисленные в подзапросе t2, могут быть вычислены без второго сканирования таблицы (в том же подзапросе), если вы переместите предложение where, которое в данный момент находится внутри t2, в операторы case и вычислите min и max с помощью over ():
SELECT cal_date,
regexp_replace(cal_date, '-', '') AS PC_cal_date,
year_num*100+week_num AS year_week_num,
CASE
WHEN year_num*100+pd_num IN (min_year_pd_num, max_year_pd_num) THEN 'A'
ELSE 'B'
END AS yr_pd_ind,
year_num*100+pd_num AS yr_pd_num,
dense_rank() OVER (ORDER BY year_num*100+week_num DESC) AS wk_index,
dense_rank() OVER (ORDER BY year_num*100+pd_num DESC) AS pd_index
FROM (select t1.*,
max(case when cal_date IN (date(date_sub(CURRENT_DATE, cast(date_format(CURRENT_DATE, 'u') AS int)+105*7+1)),
date(date_sub(CURRENT_DATE, cast(date_format(CURRENT_DATE, 'u') AS int))))
then year_num*100+pd_num end) over() as max_year_pd_num,
min(case when cal_date IN (date(date_sub(CURRENT_DATE, cast(date_format(CURRENT_DATE, 'u') AS int)+105*7+1)),
date(date_sub(CURRENT_DATE, cast(date_format(CURRENT_DATE, 'u') AS int))))
then year_num*100+pd_num end) over() as min_year_pd_num
from mstr_v.local_cal_date t1
)t1
WHERE cal_date BETWEEN date(date_sub(CURRENT_DATE, cast(date_format(CURRENT_DATE, 'u') AS int)+105*7))
AND date(date_sub(CURRENT_DATE, cast(date_format(CURRENT_DATE, 'u') AS int)+1))