Showing posts with label percentile. Show all posts
Showing posts with label percentile. Show all posts

Wednesday, December 19, 2012

SQL / SSRS - Selecting 95% and 99% (percentile) values

I was trying to generate a SSRS report where I wanted to display the 95% and 99% (percentile) values to remove the outliers.
Unfortunately there isn't a percentile function in SSRS unlike excel.

So I had to use SQL to derive these values.

To derive 95% value, select top 5% by ordering the counters of the instance in desc order. Now order these 5% in ascending order and select top 1
Select @95P = (select top 1 t.coulmnname from (select top 5 percent coulmnname from tablename order by columnname desc)t order by t.coulmnname asc)

To derive 99% value, select top 1% by ordering the counters of the instance in desc order. Now order these 1% in ascending order and select top 1
Select @99P = (select top 1 t.coulmnname from (select top 1 percent coulmnname from tablename order by columnname desc)t order by t.coulmnname asc)

Thursday, July 26, 2012

VS 2010 Load Test - Percentile values for Transaction Response Time

In VS 2010, when the load test run is complete, you can view the percentile values for transactions. Remember that these are percentile values and not percentage values.

Consider there are 10 requests where request1 to request9 took 1sec and request10 took 5 sec.
So the percentage of requests which took less than or equal to 1 sec is  9*100/10 = 90 percent

However, to calculate the percentile, we have to arrange the values in a sorted manner i.e.
1,1,1,1,1,1,1,1,1,5

Now, to calclulate the percentile, we calculate the rank by using the formula:
n = (P*N)/100 + 1/2 where P is the percentile and N is the number of items.

So the rank for 90th percentile will be:
n = (90*10)/100 + 1/2 = 9.5
We round off the rank and pickup the the nth element i.e. the 10th element i.e. 5

Thus the 90th percentile value is 5 sec but 90 percentage of transactions took 1 sec.

You can view Percentile values of 90%, 95% and 99% for each transaction in Tables->Transactions