SELECT a.ValueYear, a.Technology, format(sum(switch(NZ(a.OPAnnualOP,0)-NZ(b.OPAnnualOP,0)>=0,NZ(a.OPAnnualOP,0)-NZ(b.OPAnnualOP,0),0=0,0)),"0.000") AS IncrementalOP
FROM qryYearlyOPSavings AS a LEFT JOIN qryYearlyOPSavings AS b ON b.ValueYear=a.ValueYear-1 AND a.Opportunity=b.Opportunity AND a.Technology=b.Technology
WHERE a.ValueYear > (SELECT min(ValueYear) FROM qryYearlyOPSavings)
GROUP BY a.ValueYear, a.Technology;
|