These are my datasets:
Average Cost column and expression
This is my Median column and expression
Details Group Property variables and expression
Code that I am using to TRY and calculate the median
These are the results.
The Median is always zero and I would really like to know why. If any further information is needed to try and resolve this please leave a comment and I will do it ASAP.
What if you returned the median in the AddValue function?
Function AddValue(newValue As Decimal)
If values Is Nothing Then
values = New System.Collections.ArrayList
End If
values.Add(newValue)
Return GetMedian()
End Function
You could then use AddValue as the expression for the Median column:
="Median = " & Code.AddValue(Fields!AvgCost.Value)