Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Formula for DateDiff based on 260 work days in yea Post Reply Post New Topic
Author Message
Dawn08
Newbie
Newbie


Joined: 12 Feb 2008
Location: United States
Online Status: Offline
Posts: 22
Quote Dawn08 Replybullet Topic: Formula for DateDiff based on 260 work days in yea
     Posted: 29 Apr 2010 at 8:04am
I have two formla fields that are evaluating DateBed and DateEnd to determine what date to use. 
 
@StartDateCalc
 
if {EComp.EmDateBeg} <= {@DateBeg} then {@DateBeg} else {EComp.EmDateBeg}
 
@EndDateCalc
 
if {EComp.EmDateEnd} = date(0,0,0) then {@DateEnd} else
if {EComp.EmDateEnd} <= {@DateEnd}then {EComp.EmDateEnd} else
{@DateEnd}
 
I need to create a third formula that takes the difference between StartDateCalc & EndDateCalc to arrive at a number of "Worked" days, assume 5 days per week (Mon-Fri) 260 per year.
 
I'm familar with the DATEDIFF Function, but that uses actual days.
 
Does anyone have a suggetion on how to do this?
 
Thank you,
Dawn
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 30 Apr 2010 at 3:21am
the simplest formula that comes to mind is take the number of days that you have calculated...let call it d and divide by 7 to get weeks and multiple by 5 to your days...something like:
d/7*5  or (d/7)*5 if you're paranoid.  This will only give an approximation as there lots of days that not worked by are part of the week...holidays primarily...
 
but this should get you close.
 
HTH
IP IP Logged
Dawn08
Newbie
Newbie


Joined: 12 Feb 2008
Location: United States
Online Status: Offline
Posts: 22
Quote Dawn08 Replybullet Posted: 30 Apr 2010 at 7:08am
Thank you for the help. I will take a look at that approach to see if it will net the results I'm looking for.
 
~D
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