SQL Script.txtExcel PERCENTRANK.INC Function Example.zipHi

I have an excel sheet that makes use of the Excel PERCENTRANK.INC Function for doing the relative percentile score calculation on past 5, 10 and 15 days data available inside a Table.

The Excel PERCENTRANK.INC function calculates the relative position, between 0 and 1 (inclusive), of a specified value within a supplied array.

For understanding the basics of this excel function, please check out these 2 links -
Now, I want to do similar calculation within SQL Server Database Table. Is it possible to write a SQL Query that will give output similar to the result shown in this excel snapshot on the right hand side ?

I have added the script that will create the Sample Database named " TestDB1001 " and Table named " Table1001 " used in this work, in the text file that is attached.

I have also attached the Excel Sheet showing the actual data as well as the required output.

How to do get such query output in SQL Server ? Any help is appreciated.


Click image for larger version. 

Name:	20150714 143420.png 
Views:	5 
Size:	46.1 KB 
ID:	16452

Click image for larger version. 

Name:	20150714 143346.png 
Views:	2 
Size:	44.3 KB 
ID:	16453