select avg(pageViews) as avgPageViewsPerDay from ( select top 95 percent pageViews from ( select top 95 percent count(*) as pageViews from hits group by datepart(day, viewTime), datepart(month, viewTime), datepart(year, viewTime) order by pageviews asc ) x order by pageviews desc ) yTo illustrate the flaw I forsee Ill use an example, your main result has a 100 records and you want a 10% trimmed mean. So you need to cut off the top 5 and bottom 5 leaving 90 results left. When you run the first select top 95% ordered ascending it will trim the bottom 5 rows, but when you run the descending trim, it will take 95% of the remaining 95 records, meaning only 4.75 records will be trimmed, now depeding on how sql server rounds the value, this maybe or maybe not be accurate.