Might not be the best solution.
But the idea is to LEFT OUTER JOIN on distinct quarters for each type and then check for NULL values.
Written in MS Access, so the actual SQL might slightly differ (iif function).
select
iif (type = 'CWV', '(3) ' + bc.quarter + '_' + type, iif(type = 'POR', '(4) ' + bc.quarter + '_' + type, null)) as scenario,
type,
bc.quarter,
program,
geo,
sum(ca) as units,
iif(cw.quarter is not null and por.quarter is not null, 'SHOW', 'HIDE') as show_or_hide
from (
bc_reports as bc
left outer join (select distinct quarter from bc_reports where type = 'CWV') cw on bc.quarter = cw.quarter
)
left outer join (select distinct quarter from bc_reports where type = 'POR') por on bc.quarter = por.quarter
group by bc.quarter, type, program, geo, cw.quarter, por.quarter
order by 3, 2
Output
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…