6 Replies Latest reply: Mar 27, 2017 5:08 PM by Maximiliano Carena RSS

    Compare the period from one month to the previous with the year change

    Maximiliano Carena

      Hello! How are you ?, I have a query since I am having problems comparing periods when I move from one year to another, for example if I am positioned in January 2017 and I want to see what December 2016.


      My case is the following, in a simple way, I have selected the field MES (month) (built with the Calendar on the main field FECHA) and the field AÑO (year) (idem. Previous), then I want to see the sales generated in the last month taking into account That the AÑO (year) changes.



      Situation: I have a selection in the Field [FECHA.autoCalendar.Month] (Month) and [FECHA.autoCalendar.Year] (Year).


      The formula that I am using (contains SET ANALYSIS function) and that serves me to buy months within the same year is as follows:


      Sum ({<[DATE.autoCalendar.Month] = {$ (vPriorMonth)}>}) VALUE)


      The variable vPriorMonth is as follows: = Month (addmonths (max (DATE, - 1))



      I did this but DO NOT WORK for the change of Year: SUM ({<[DATE.autoCalendar.Month] = {$ (vPriorMonth)}, [DATE.autoCalendar.Year]>} VALUE). It does not work properly since it makes me add up all December sales of all the years, since it leaves me released the field [FECHA.autoCalendar.Year] (Year).


      It is understood? Can anybody help me?


      Thank you very much