13 Replies Latest reply: Jul 5, 2018 10:08 AM by Anil Samineni RSS

    Case statement..

    Raman Singh

      Hi,

       

      I have been trying to figure out a way to calculate the out of a column depending on the values of other columns.

       

      From the table below I would like to create an expression to say:

       

      case if Level = 'AOG' and DateTime is between 18:00 and 08:00 (following morning) then 'AOG OO'

           or if Level = 'AOG' and DateTime is on a Weekend then 'AOG OO' Else Level

       

      CustomerLevelDateTime
      AAOG2018-05-01 09:08:06
      BRoutine2018-05-03 13:23:04
      BRoutine2018-05-07 19:11:07
      AAOG2018-05-11 23:30:02

       

      OUTPUT REQUIRED:

       

      CustomerOriginalLevelNewLevelDateTime
      AAOGAOG2018-05-01 09:08:06
      BRoutineRoutine2018-05-03 13:23:04
      BRoutineRoutine2018-05-07 19:11:07
      AAOGAOG OO2018-05-11 23:30:02

       

      This calculation is being done to work out any levels that fall into out of hours (out of normal working hours).

       

      Thank you in advance for your assistance.

       

      stalwar1youssefbelloum