
Re: Calculating previous year with Aggr and Distinct function
kushal chawda May 8, 2017 6:34 AM (in response to Steve Mackerman)try this
SUM({<[Date.autoCalendar.Year]>}AGGR(SUM({$ <[Date.autoCalendar.Year] = {"$(=max([Date.autoCalendar.Year])1)"}>}DISTINCT TEU), JH_JobNum))

Re: Calculating previous year with Aggr and Distinct function
Steve Mackerman May 8, 2017 6:52 AM (in response to kushal chawda )Kushal, I've already tried that. Sorry didn't work.


Re: Calculating previous year with Aggr and Distinct function
AC BC May 8, 2017 6:34 AM (in response to Steve Mackerman)Selected Year : Sum({<Year = {"$(=Max(Year))"}>}Sales)
Previous Year: Sum({<Year = {"$(=Max(Year)1)"}>}Sales)
These two expression with out selections will give you the sales of Max Year and its previous Year but if you select any year then it gives selected Year and Previous Year Sales

Re: Calculating previous year with Aggr and Distinct function
AC BC May 8, 2017 6:34 AM (in response to AC BC)Check it with your data otherwise provide a sample


Re: Calculating previous year with Aggr and Distinct function
Steve Mackerman May 8, 2017 6:47 AM (in response to Steve Mackerman)Kiran, many thanks for the prompt reply.
I have used your syntax and found that I must select both years to obtain the previous years data at the same time as the year I want to see data for.
Therefore if I wanted to see the primary data for 2016 and just wanted to see secondary data for 2015 I must select both 2015 and 16.

Re: Calculating previous year with Aggr and Distinct function
AC BC May 8, 2017 7:39 AM (in response to Steve Mackerman)I think something went wrong the expressions I have given you are for eg, in real with out selections the first expression gives the sales for the Max year and second one gives for previous year.
Load * Inline [
Year, Sales
2014, 1500
2015, 1700
2016, 1800
2017, 1900
];
Now try my expression in a text objects


Re: Calculating previous year with Aggr and Distinct function
Sunny Talwar May 8, 2017 7:42 AM (in response to Steve Mackerman)May be try this
Sum({<[Date.autoCalendar.Year] = {"$(=Max([Date.autoCalendar.Year])1)"}>} Aggr(Sum({<[Date.autoCalendar.Year] = {"$(=Max([Date.autoCalendar.Year])1)"}>} DISTINCT TEU), JH_JobNum))

Re: Calculating previous year with Aggr and Distinct function
Steve Mackerman May 8, 2017 8:11 AM (in response to Sunny Talwar )Sunny, that has worked perfectly.
Many Thanks
