I have a start date and an end date, and am calculating the weekdays in between with the following:
I created a calcuated field called CountWeekDays, and it equals: Code.getBusinessDaysCount(Fields!date_created.Value,Fields!date_closed.Value)
I can get an Average of that like this: =Avg(Fields!CountWeekDays.Value)
However, I cannot get the Median the same way. How can I get the median number of something that is calculated?
The code I am using to get the weekday count is as follows:
Function getBusinessDaysCount(ByVal tFrom As Date, ByVal tTo As Date) As Integer
Dim tCount As Integer
Dim tProcessDate As Date = tFrom
For x as Integer= 1 To DateDiff(DateInterval.Day, tFrom, tTo) + 1
If Not (tProcessDate.DayOfWeek = DayOfWeek.Saturday Or tProcessDate.DayOfWeek = DayOfWeek.Sunday) Then
tCount = tCount + 1
End If
tProcessDate = DateAdd(DateInterval.Day, 1, tProcessDate)
Next
Return tCount
End Function