I'm trying to create an "outlier" filter for a Crystal Report. We have some values that are throwing off averages and want to filter them out. Using standard deviation to filter out the upper end of values seemed like a good solution. In my select formula I originally had the following:
(@TotalAge) > (Average(@TotalAge) + (StdDev(@TotalAge) * guiFilterOutlierAmount.SelectedValue))
(guiFilterOutlierAmount is a drop down list with the amount of standard deviations to filter from, 0-3)
Using this in the select formula, I kept getting the error "The function cannot be used because it must be evaluated later." My next solution was to create a SQL Expression that did the Average and StdDev calculations inside.
(@TotalAge) > (%TotalAgeMean + (%TotalAgeStdDev * guiFilterOutlierAmount.SelectedValue))
This worked fine but did not allow me to do dynamic groupings like I needed. It was simply a sub query that calculated the standard deviation for a whole table. I've also experimented with using a stored procedure that calculates the standard deviation but still can't get around the dynamic grouping problem that crystal handles. I'm running out of ideas now, any thoughts or suggestions would be appreciated.
(@TotalAge) > (Average(@TotalAge) + (StdDev(@TotalAge) * guiFilterOutlierAmount.SelectedValue))
(guiFilterOutlierAmount is a drop down list with the amount of standard deviations to filter from, 0-3)
Using this in the select formula, I kept getting the error "The function cannot be used because it must be evaluated later." My next solution was to create a SQL Expression that did the Average and StdDev calculations inside.
(@TotalAge) > (%TotalAgeMean + (%TotalAgeStdDev * guiFilterOutlierAmount.SelectedValue))
This worked fine but did not allow me to do dynamic groupings like I needed. It was simply a sub query that calculated the standard deviation for a whole table. I've also experimented with using a stored procedure that calculates the standard deviation but still can't get around the dynamic grouping problem that crystal handles. I'm running out of ideas now, any thoughts or suggestions would be appreciated.