1 Reply Latest reply on Jun 24, 2013 6:03 AM by Shawn Wallwork

    DATEDIFF on the same Date

    stevenhababou

      Hello,

       

      i looking for calculate the Datediff between Date on ActionID 1011 and Date on ActionID 1021, i'm in trouble because the date is the same slot..

       

      Ex : DATEDIFF('day',[HORODATE],[HORODATE]) return 0 because i can't specify which Date to choose...

       

      See below the capture...

       

      Thanks a lot for your help !

      DateDiff.PNG.png

        • 1. Re: DATEDIFF on the same Date
          Shawn Wallwork

          Steven, first a quick note: Please post within the Forums proper, out here on the Community page, if your question doesn't get answered right away, it will get deleted within 2 days. You'll also get more traction in the Forums stream, which is where most people search for questions to answer. Thanks.

           

          You can do what you're trying to do with this table calculation:

           

          DATEDIFF('day', ATTR([Order Date]),LOOKUP(ATTR([Order Date]), -1))

          or

          DATEDIFF('day', LOOKUP(ATTR([Order Date]), -1), ATTR([Order Date]))

           

          Depending on whether you want positive or negative values.

           

          It basically uses the previous row of your date field in the DATEDIFF() calculation. You'll want to 'hard set' the 'compute using' to your date field so it doesn't change when/if you move the pill to a different shelf. (See attached.)

           

          --Shawn