1 Reply Latest reply: Mar 9, 2012 3:08 AM by jagan mohan rao appala RSS

    How to find last 3, 6, 12 months ???

      Hi in my script i need to include a field such as month values ,which should hold the last 3months , last6months, last 12 moths(3 colums).. When i click last 3 months the calculation should change.. I need it in script

       

       

      For example i have used the below script for finding QTR1, 2, 3, 4 , simillarly i want for last3 months , 6 , 12 months

       

      If(Num(month([Session Start]))<=3, 'Q1-' & Year([Session Start]),

      If(Num(month([Session Start]))<=6, 'Q2-' & Year([Session Start]),

        If(Num(month([Session Start]))<=9, 'Q3-' & Year([Session Start]),

         If(Num(month([Session Start]))<=12, 'Q4-' & Year([Session Start])

          )

           )

            )

             ) as Qtr,

        • Re: How to find last 3, 6, 12 months ???
          jagan mohan rao appala

          Hi,

           

          Use the following expression

           

          For last 3 Months:

           

          =Sum({<DateField={'>=$(=MonthStart(Max(DateField), -2))<=$(=MonthEnd(Max(DateField)))'}>} Sales)

           

          For last 6 Months:

          =Sum({<DateField={'>=$(=MonthStart(Max(DateField), -5))<=$(=MonthEnd(Max(DateField)))'}>} Sales)

           

          For last 12 Months:

          =Sum({<DateField={'>=$(=MonthStart(Max(DateField), -11))<=$(=MonthEnd(Max(DateField)))'}>} Sales)

           

          Regards,

          Jagan.