Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Date/Time Calculation base on Working Week Post Reply Post New Topic
Author Message
Sherri_k
Newbie
Newbie


Joined: 27 Feb 2009
Online Status: Offline
Posts: 1
Quote Sherri_k Replybullet Topic: Date/Time Calculation base on Working Week
     Posted: 27 Feb 2009 at 8:45am
I have been tasked with creating a report which will enable us to monitor our response times to customers and am struggling with how best to tackle this.
 
Each call placed is logged with a Start Date/Time value and then when it is closed a Close Date/Time is automatically assigned - straightforward so far?
 
I need to calculate how much time it takes us to resolve each call - i.e. the difference between the Start Date/Time and the Close Date/Time.
 
This would be fine except for the fact that I need to take into account that working hours are only 9:00am until 5:30pm Monday to Friday - so any time outside of what is considered our working week needs to be ignored in terms of the calculation.
 
Example, if a call is logged on 27/02/09 (i.e. a Friday) at 4:30pm and then resolved at 5:00pm on the same date, then this is fine as a simple calcualtion will work out that it took 30 minutes to resolve. However, if the same call was not resolved until 02/03/09 (i.e. the following Monday) at 10:15am, the simple calculation will assume that it has taken is 3945 minutes when it actually needs to result in 135 minutes.
 
I would be extremely grateful for any assistance you can offer!
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 02 Mar 2009 at 6:33am

You would think that would be pretty straight forward, but all the twists.

If calls are usually resolved in less than a week, so there is only 1 weekend) I would try something along the following lines
 
if the date is the same, simple calc. if the dates differ, calculate the number of days different and multiple by 930 ( the number of minutes between 5:30 pm and 9:am) and subtract that from the simple difference...but what about weekends.  Figure out if the weekday number of the ending date is less than the startdate ( I believe that there is function to get the weekday number)  If the number of the ending date is bigger it is in the same week, so we are done, if the ending date is smaller, it went over the weekend, so subtract 1020 (number of minutes from 9-5:30 for 2 days) from the calculation.
 
hope this helps
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum