Thanks PGStats. I put the original expression in the from section in place of "Calculated Lookup1". Now it works! from GMSCusip.afs_group_master_bd a left join Lookup l on a.breakdown = l.breakdown and a.FAS115 = l.FAS115 and a.type = l.type left join GMS gm on a.breakdown = gm.breakdown left join AgencyShock ag on ag.Product = (case when a.Cat = 'Municipal' then a.credit_rtng when a.Cat is null and (a.FAS115 || a.type || a.breakdown) = (l.FAS115 || l.type || l.breakdown) then l.FHFA_Template else a.Cat end)
... View more