1 Reply Latest reply on Jun 19, 2018 12:20 PM by Don Wise

    Filtering specific days of the week and hours of the day.

    Will Martin

      I'm curious, other than trying to write a calculated field (which I have very limited ability to do so as I am not very astute with scripting), is there a way to filter data by specific day of the week and certain hours. Specifically, I would like to show only from Friday evening at 6:00 PM to Saturday at 3:00 AM and then Saturday from 6:00 PM to Sunday at 3:00 AM. I can get the days of the week, I can get the hours, but it includes Friday Morning from 12:00 AM to 3:00 AM and then Sunday from 6:00 PM to 11:59 PM. It works, but it doesn't give me exactly what I am looking for. Would you all be able to show me or tell me how to do that specific action? Thanks for the help.

        • 1. Re: Filtering specific days of the week and hours of the day.
          Don Wise

          Hi Will,

          Without actual data it is hard to do.  But you could try this for a shift period that crosses over midnight into the next day (not the preceding day):

           

          // Shift Period

          // For the first shift segment (hours 1800-0000), keep the Date as is

          // For second shift segment crossing over midnight (hours 0000-0300), set the Date to the next day from 0-3

           

          // From Hours 1800-0000

          IF  datepart('hour', [Your Date/Time]) >=18 and datepart('hour', [Your Date/Time]) <=23 then [Your Date/Time]

           

          // From Hours 0000 to 0300

          ELSEIF  datepart('hour', [Your Date/Time]) >=0 and datepart('hour', [Your Date/Time]) <=3 then

             dateadd('day', 1, [Your Date/Time]) END

           

          If this answers your question, please mark this response as correct so that others can find it useful in the future. Thx, Don