COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: ambuj2k50 on 15 Oct 2012 12:06:55 AM

Title: How to find the first value in a column
Post by: ambuj2k50 on 15 Oct 2012 12:06:55 AM
Hi Cognos Gurus,

Lets say the output of a column is

Column A
abc
def
cde

What is the expression to create a data item that will give only the output abc.

Thanks in advance.
Title: Re: How to find the first value in a column
Post by: blom0344 on 15 Oct 2012 02:15:58 AM
the concept 'first' is hazardous, cause database are not supposed to store data in an ordered fashion. By selecting data we imply a sorting through the query. 

Solutions either involve olap style functions like rownumber() or running aggregates like running-count.  You then need to apply the proper filter with 'after auto-aggregation' set to make sure you can filter . Thare are lots of posts dealing with this