COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: paddie on 08 Dec 2008 12:33:00 PM

Title: How to calculate Stastical 'Mode' in Cognos
Post by: paddie on 08 Dec 2008 12:33:00 PM
Hi,

I would like to know how to calculate Stastical 'Mode' in Cognos. There is no function avalialble as it is available for Mean and Median.

Mode is the most frequently occuring number in a data set.

Appreciate your help.

Thanks!
Title: Re: How to calculate Stastical 'Mode' in Cognos
Post by: jwilliamstd on 20 Oct 2009 03:14:10 PM
hi Paddie,

could you find the statistical ModE function in cognos. I could not find.. did you find a work around ??
Title: Re: How to calculate Stastical 'Mode' in Cognos
Post by: VisioX on 21 Oct 2009 12:18:23 PM
I would solve the problem on the DB side with something like that:

set rowcount 1;
select distinct colname
from  table subordinate
group by colname
having count(*) < (  select distinct count(*)
                     from table
                     group by subordinate.colname )
order by  count(*) desc;
set rowcount 0;
Title: Re: How to calculate Stastical 'Mode' in Cognos
Post by: truebokonon on 30 Aug 2013 02:37:29 AM
Though it's an old post I thought to reply since I struggled a lot to find a solution, here it it:

Create a query calculation or data item with the following:

maximum (if (running count (<expression> [for <expression>])=maximum(running count (<expression> [for expression]))) then (<expression>) else (null)))

first maximum is for taking out the null value from the result.

Hope it helps
Emanuele