8 Replies Latest reply: May 8, 2017 8:11 AM by Steve Mackerman RSS

    Calculating previous year with Aggr and Distinct function

    Steve Mackerman

      Hi,  newbie here.

      I'm trying to calculate totals for the previous year to what I have selected, for comparison purpose.


      To obtain the data for the year that I have selected I use the following:


      SUM(AGGR(SUM({$ <[Date.autoCalendar.Year] = {"$(=maxstring([Date.autoCalendar.Year]))"}>}DISTINCT TEU), JH_JobNum))


      This gives me the sum of the TEU for each JH_JobNum, for the year that I have chosen.


      However I would also like to diaply the previous years data for comparison.

      I have tried a multitude of lines but failing to get the data.

      I thought that the following would have provded me with the data, but not playing ball:

      SUM(AGGR(SUM({$ <[Date.autoCalendar.Year] = {"$(=maxstring([Date.autoCalendar.Year])-1)"}>}DISTINCT TEU), JH_JobNum))


      Could anyone shed some light on where I'm going wrong?