8 Replies Latest reply: May 28, 2013 11:21 AM by sree anaarasi RSS

    how to get recent 10 months on trend chart

      Hello experts,

       

       

      1. I have to plot a trend chart of sales for RECENT 10 months where as i have total 15 months.

      2. my X-axis is xdate (5/1/2013,4/1/2013,3/1/2013.....and so on) and my Y-axis as expression which shows sales

       

      my problem is how will i get recent 10 months out of 15 months? where as i have to ignore oldest 5 months.

       

       

      Regards,

      Santosh

        • Re: how to get recent 10 months on trend chart
          j i

          Hi, you need to use set analysis. Put this in your expression:

           

          sum( {$<Date = {">=$(=AddMonths(Today()),-10)"} >} Sales )

          • Re: how to get recent 10 months on trend chart
            Borja Rodriguez

            You can try something like this in the expression in the chart:

             

            sum( {<YearMonth_Sequential={">=$(=max(YearMonth_Sequential)-10)"} >} field)

             

            This will react to the user selections and will always show the most recent 10 YearMonths.

             

            Note: YearMonth is a field containing a sequential number for your YearMonths, with a +1 increment. This way it will work even with the last and first months of the year. You can create this field in the script by doing something like:

             

            LOAD

            ...

            Year * 12 + Month as YearMonth_Sequential,

            ...

             

            It should look like this in your table (example for 2012 and 2013):

             

            YearMonthYearMonth_Sequential
            2012124145
            2012224146
            2012324147
            2012424148
            2012524149
            2012624150
            2012724151
            2012824152
            2012924153
            20121024154
            20121124155
            20121224156
            2013124157
            2013224158
            2013324159
            2013424160
            2013524161
            2013624162
            2013724163
            2013824164
            2013924165
            20131024166
            20131124167
            20131224168

             

             

            Kind Regards,

             

            Borja