sql server - T-SQL for a normalized average -


i'm looking way calculate useful average given set of values may contain huge spikes. (e.g 21, 54, 34, 14, 20, 300, 23 or 1, 1, 1, 1, 200, 1, 100) spikes can throw things off when using standard average calculation.

i looked using median doesn't give desired result.

i implement in t-sql

any ideas?

this way can take away highest , lowest 25 % before calculating result.

declare @t table (col1 int)  insert @t select 21 union  select 54 union  select 34 union  select 14 union  select 20 union  select 300 union  select 23 union  select 1 union  select 1 union  select 1 union  select 1 union  select 200 union  select 1 union  select 100   select avg(col1) ( select top 67 percent col1 ( select top 75 percent col1 @t order col1 ) order col1 desc) b 

Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -