COGNOiSe.com - The IBM Cognos Community

IBM Cognos Analytics Platform => Cognos Analytics => Reporting => Topic started by: Cogency on 16 May 2024 09:52:10 PM

Title: Adding an index to a query
Post by: Cogency on 16 May 2024 09:52:10 PM
Hi all,

I'm trying to add an index column in a query that starts from 1 and counts up and restarts at 1 for each group (TEAM in the example below).  If anyone had any tips I'd be very grateful because I'm not getting very far at the moment.

TEAM   GAMES   GOALS   PLAYER   INDEX
A   0   0   1   1
A   0   0   2   2
A   1   1   3   3
A   1   2   4   4
A   3   0   5   5
A   5   3   6   6
B   1   5   1   1
B   2   0   2   2
B   3   2   3   3
B   4   0   4   4
B   4   2   5   5


Sorry for the alignment of the data there.  It's the last column I'm trying to create.

Thank you in advance.

Best,

Cogency
Title: Re: Adding an index to a query
Post by: dougp on 20 May 2024 02:43:02 PM
running-count(1 for [TEAM])
Title: Re: Adding an index to a query
Post by: Cogency on 28 May 2024 08:36:29 PM
Thank you dougp that's working perfectly for me.