COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: midhl on 16 Mar 2011 10:55:27 PM

Title: Could the given calculation be acheived in Cognos
Post by: midhl on 16 Mar 2011 10:55:27 PM
Hi,

Could the below calculation be implemented in cognos to calculate the 25th Percentile.

for example:

Array[1] = 1
Array[2] = 2
Array[3] = 3
Array[4] = 4

To calculate 25th percentile
p = 25
n = 4 (# of elements in array)
x = 1 + ((p/100) * (n-1))
x = 1 + (.25 * 3) = 1.75

k = 1 (integer part of x)
d = .75 (fractional part of x)

If d = 0 then 
   25th percentile = Array[k]
Else
   L = d * ( Array[k+1] – Array[k] )   =  .75 *  (2 – 1)  = .75
    25th percentile = Array[k] + L  =  1 + .75 = 1.75
End-If;


Currently we have count of records. Could someone let me know whether it is possible to create arrays in cognos or is it possible to implement the above calculation using count of records

Thanks in advance,