Is there a way to use the NTile function (SQL Server 2005) on a subset of the records? Here's my situation. I'm pulling call center data and need to show all of the call reps. But I need to assign them into quartiles on various measures only if they meet a certain minimum of calls handled. For example, I need to show everyone's average call handle time but bucket them into quartiles only if they handled at least 10 calls. If they didn't take ten calls, they aren't part of any quartile but are included in the output. Is this possible or do I need to create a table and fill in the quartiles in a second pass where the call count >= 10?
This gives me good quartiles for all reps without regard to number of calls taken...
This one assigns the same quartiles as above but hides the value if there are less than 10 calls resulting in uneven distribution between the groups...
Is there another way?
asked Oct 19 '09 at 06:29 PM in Default
Yes - you're selecting from a table - so just select from a derived table with a WHERE clause.
I'm sorry that I can't give you a more relevant example - but I can't really get the feel for what your whole query looks like.
answered Oct 19 '09 at 07:13 PM
Matt Whitfield ♦♦