Hey you would need to do the group by.
Something like below:
LOAD * INLINE [
Country, City, Sales, Year
Australia, Melbourne, 500, 2008
Canada, Toronto, 900, 2008
India, Mumbai, 1600, 2008
India, Chennai, 2500, 2008
Australia, Melbourne, 700, 2009
Canada, Toronto, 800, 2009
India, Mumbai, 2000, 2009
India, Chennai, 3000, 2009
sum(if(Year<>2008 and City='Mumbai',Sales)) as NewSales,
sum(if(Year=2009 and City<>'Chennai'and City <>'Mumbai',Sales)) as NewSales2
group by Country,City;
my reading of the Reference Manual is that the script language doesn't actually support set expressions - these are only discussed in the RM in the context of chart expressions. This issue threw me just last week, too! Hence, in the script you'll need to take advantage of the if() function and the WHERE clause in your load statements.