2 Replies Latest reply on Aug 6, 2018 11:28 AM by Anthony H

    Time Grouping from Date Time field

    Anthony H

      IF

      [Disch_Order_Date_Time] < 09:00:00 then "before 9" ELSEIF

      [Disch_Order_Date_Time] < 12:00:00 then "before noon" ELSEIF

      [Disch_Order_Date_Time] < 03:00:00 then "Under 2 Hours" END

       

      Not sure why this calc is not working for me.

      Im thinking I may have to split date and time from the column and my time format im sure is incorrect.

       

      Any help is appreciated.

        • 1. Re: Time Grouping from Date Time field
          Ankit Bansal

          Can you try this:

           

          IF

          DATEPART('hour',[Disch_Order_Date_Time] )< 9 then "before 9" ELSEIF

          DATEPART('hour',[Disch_Order_Date_Time] )< 12 then "before noon" ELSEIF

          DATEPART('hour',[Disch_Order_Date_Time] )< 3 then "Under 2 Hours" END

           

          You might want to put 15 instead of 3,  if its meant to be afternoon 3 pm. If its meant to be 3 am then change the order of if conditions as :

           

          IF

          DATEPART('hour',[Disch_Order_Date_Time] )< 3 then "Under 2 Hours"  ELSEIF

          DATEPART('hour',[Disch_Order_Date_Time] )< 9 then "before 9" ELSEIF

          DATEPART('hour',[Disch_Order_Date_Time] )< 12 then "before noon"

          END

           

          Thanks,

          Ankit Bansal

          • 2. Re: Time Grouping from Date Time field
            Anthony H

            Thank you so much Ankit this worked perfectly.