4 Replies Latest reply: May 19, 2015 3:44 PM by Sebastián Villegas RSS

    How to return null() when using MAX and group BY()

      Hi,

       

      I am calculating if a product was delivered on time, sometimes there can be many deliveries of the same product, i need the latest deliver to be the time used against the expected delivery, but sometimes one of the deliveries has no date insterted yet, and it will use the max date instead of the null()

       

      Example:

       

      Position     expected date    Delivery date

      30               04/04/2015           03/04/2015

      30               04/04/2015           null()

       

      Result after:  expected date, max(Delivery date) , Group by position;

       

      Position     expected date    Delivery date

      30               04/04/2015           03/04/2015

       

      What i need:

       

      Position     expected date    Delivery date

      30               04/04/2015           Null()

       

      The use of MAX is necessary since sometimes instead of null() i could have 04/04/2015, so it will display the latest delivery.

       

      How do i get the max when is necessary, and the null() when one input is set to null()?

       

      Regards