Blog

 

Weekdays, weekends, and reporting over disjointed timeframes



We’ve had a few questions recently about how to report on disjointed, separate time frames.

For instance, How do I report on only after-hours calls?  Or maybe I want to report on calls between 8 AM and 5 PM, Monday through Friday, and also 9 AM to Noon on Saturday.

Let’s start with that first one.

Example 1, Calls after hours

For our discussion here, let’s assume any calls made between 6 pm and 6 am are considered “After hours” and we’d like to report on those.

Let’s start in Browse Calls.

Add in the two fields, day_of_week and hour_of_day to our field picker.

Those are the two fields we’ll use to filter with in search filters

Let’s build a reasonable search string now.  I recommend doing this in a real text editor and pasting it in, not in the little box in the app itself, if only so you can see the whole thing.  We want times before 6 or after 18.  That’s just hour_of_day<6 OR hour_of_day>18

Paste that into search filters and click refresh/search.

You may or may not see much difference, but if you now click graph calls over time in the upper right to change to General Report, you’ll definitely see a difference.

At this point, any report you make – as long as you don’t remove the extra search parameters! – will be filtered to only showing those times.

Example 2, more complexity

Let’s take a far more complex example.  Normal staffed phone times are 8 AM to 5 PM, Monday through Friday.  On Wednesdays a second part time crew comes in from 5 PM until 10 PM for an evening shift, and that same group is also in on Saturdays from 9 AM to 2 PM.

Did you follow that?  Monday, Tuesday, Thursday and Friday we want to report on 8-5, Wednesday is 8 AM to 10 PM, and Saturday 9 AM to 2 PM.

There’s a couple of ways to write this – the key points are to

  • use parenthesis to group things appropriately
  • try to keep it as readable as possible
  • make sure you get your <, <=, > and >= right.

Let’s start small – here’s the easy part, the “regular” days:

((day_of_week="Mon" OR day_of_week="Tue" OR day_of_week="Thu" OR day_of_week="Fri") AND (hour_of_day>=8 AND hour_of_day<17))

When you plug that into  the search field and run the search in an otherwise stock/empty General Report, you end up with something like the below. (My example is over timeframe other/previous week).

So, let’s add Wednesday and Saturday.

((day_of_week="Mon" OR day_of_week="Tue" OR day_of_week="Thu" OR day_of_week="Fri") AND (hour_of_day>=8 AND hour_of_day<17)) OR (day_of_week="Wed" AND hour_of_day>=8 AND hour_of_day<22) OR (day_of_week="Sat" AND hour_of_day>=9 AND hour_of_day<14)

And that should be all those times.

From there, all the standard reporting should work to slice and dice this any way you want!

Alternate search…

Depending on hour your brain works, you might find the following search to be more readable than the one above.

((day_of_week="Mon" OR day_of_week="Tue" OR day_of_week="Wed" OR day_of_week="Thu" OR day_of_week="Fri") AND (hour_of_day>=8 AND hour_of_day<17)) OR (day_of_week="Wed" AND hour_of_day>=17 AND hour_of_day<22) OR (day_of_week="Sat" AND hour_of_day>=9 AND hour_of_day<14)

The difference is only that in the original, I include the 4 “normal” days, then all of Wednesday and that little piece of Saturday.  In this version, I instead include that part of Wednesday that’s a “regular” time as part of the normal work week, then at the end add in those extra few hours and the Saturday piece.

Happy Reporting!

 



Read more posts in the Cisco CDR So you'd like to category