i have a query that calculates an average value from a column of integers,however i now need to "trim off" the top and bottom say, 2% of the values and calculate the average of the remaining values. is this possible?
i have the follwoing which trims off the minimum and maximum values, but i need to use a percentage rather than just min and max. Hope this makes sense
Cheers, Craig
Si fractum non sit, noli id reficere
i have the follwoing which trims off the minimum and maximum values, but i need to use a percentage rather than just min and max. Hope this makes sense
Code:
AVGTurnRound = CASE WHEN CAST(COUNT(*)-2 AS FLOAT) = 0 THEN 0 ELSE
convert(decimal(10,2),(sum(turnroundtime)-min(turnroundtime)-max(turnroundtime))/cast(count(*)-2 as float))/100 END
Cheers, Craig
Si fractum non sit, noli id reficere