3 Replies Latest reply: Apr 16, 2014 9:47 AM by Aut.Mark Aut.Mark RSS

    Max "Customer Order Date" and it's previous Record

    Aut.Mark Aut.Mark

      Hi Community,

      I'm trying to work out the previous Max Order Date (by customer).

      I would like to obtain 2 informations:

      1) the last Customer Order Date  >>>>> OK  [expression:  Max (ORDER_DATE)      or       aggr(max(ORDER_DATE),Customer)]

       

       

      2)the previous last Customer Order Date >>>>>> PROBLEMS

      ---------------------------------------------------------------------------------------------------------------------------------------------------------

      This is my GOAL:

       

      Customer Max(ORDER_DATE)PREVIOUS max(ORDER_DATE)
      Tom11/04/201408/04/2014
      Mark15/04/2014

      13/01/2014

       

       

      This is my original table:



      ORIGINAL TABLE
      Customer ORDER_DATE  Order_Quantity
      tom06/04/2014
      tom07/04/2014
      tom08/04/20145
      tom09/04/2014
      tom10/04/2014
      tom11/04/20144
      tom12/04/2014
      tom13/04/2014
      tom14/04/2014
      tom15/04/2014
      tom16/04/2014
      Mark06/04/2014
      Mark07/04/20142
      Mark08/04/2014
      Mark09/04/2014
      Mark10/04/2014
      Mark11/04/20143
      Mark12/04/2014
      Mark13/04/20143
      Mark14/04/2014
      Mark15/04/20144
      Mark16/04/2014

       

       

       

      Thanks

       

      Markus