COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: que1983 on 07 Jul 2017 01:58:30 PM

Title: Group By Last in Report Studio Query
Post by: que1983 on 07 Jul 2017 01:58:30 PM
Sample Data
Loan#            Event_Code           Date
1111               100                     6/1/15
1111               100                     6/2/15
1111               141                     6/19/17
1111               152                     6/21/17      /*keep*/
1112                100                    6/19/17     /*keep*/
1113                100                    6/5/17
1113               112                     7/10/17 /*keep*/
1114               100                     8/1/16  /*keep*/
In my cognos query I need to be able to choose the last instance of the event_code by loan# and the date, while deleting the others.  How can I accomplish this???
Title: Re: Group By Last in Report Studio Query
Post by: New_Guy on 07 Jul 2017 02:04:15 PM
Hi,
create data item like below
[maxeventcode] with the expression maximum([event_code] for [loan#],[date])

and add a filter
[event_code] = [maxeventcode]
Good luck
New guy