December 17, 200718 yr Should hopefully be a very quick one here for one of you super clever dudes! Is there a calculation that will give the total number of week days (excluding weekends within a given period?
December 17, 200718 yr If ( Date1 and Date2 ) ; Let ( [ spanStart = Date1 - Mod ( Date1 ; 7 ) ; spanEnd = Date2 - Mod ( Date2 ; 7 ) + 6 ; wkndCount = Div ( spanEnd - spanStart + 1 ; 7 ) * 2 - (spanStart < Date1 ) - ( spanEnd > Date2 ) ] ; Date2 - Date1 + 1 - wkndCount ) )
December 17, 200718 yr Indeed, but Michael's CF is slightly more flexible: http://www.briandunning.com/cf/452 If you put ValueCount( around it.... it could then be made to deal with regular days off as well! --sd
December 17, 200718 yr Author Tried your calculation replacing date1 and date2 in your calculation with the 'from' and 'to' dates in my database but the first line is coming up with the 'There are too few parameters in this function' message!
December 17, 200718 yr Did you call it this way: ValueCount(WeekDaysInRange ( FromDate ; ToDate ; "1¶7" )) : --sd
December 17, 200718 yr If ( Date1 and Date2 [color:red]) ; Remove the bracket in red. Soren, I agree Michael's is more flexIble than mine.
December 17, 200718 yr I don't think you need to use a recursive calculation for this. If you want the flexibility of being able to select which days are considered weekends, see here: http://www.fmforums.com/forum/showtopic.php?tid/155958/post/156042/#156042
Create an account or sign in to comment