Try below
select
ifnull(format('FY%s-Q%sM%s', any_value(year), any_value(quartal), max(month)), any_value(YY_QQ_STATUS)) as YY_QQ_STATUS,
Program
from (
select *,
regexp_extract(YY_QQ_STATUS, r'FY(dd)-QdMd') year,
regexp_extract(YY_QQ_STATUS, r'FYdd-Q(d)Md') quartal,
regexp_extract(YY_QQ_STATUS, r'FYdd-QdM(d)') month
from `project.XXXXFinance.FINANCE_OPS_REPORT_V`
)
group by Program, ifnull(format('FY%s-Q%s', year, quartal), YY_QQ_STATUS)
if applied to sample data in y our question - output is
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…