COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Framework Manager => Topic started by: japwah on 14 Dec 2016 01:55:28 PM

Title: Return rows corresponding to latest date for a composite key
Post by: japwah on 14 Dec 2016 01:55:28 PM
This is a question that's probably simple for most of you. I have not used Framework Manager for years, and have only been exposed to it briefly.

I have a table that looks like this:

Row         AgentID       PolicyID       PolicyType        Last Name      UpdatedDate

1              11111          12345          Regular           Smith              Jan 1, 2016
2              11111          12345          Special            Smith              Jan 5, 2016
3              22222          23456          Special            Brown              Jan 2, 2016
4              22222          23456          Special            Taylor              Jan 3, 2016

In FM, I want to somehow apply a filter to the table so the result returns only the data corresponding to the latest Updated date for an AgentID/ PolicyID combination, e.g. only rows 2 and 4.

Thanks for your help.
Title: Re: Return rows corresponding to latest date for a composite key
Post by: MFGF on 15 Dec 2016 02:08:12 AM
Quote from: Yason3 on 14 Dec 2016 01:55:28 PM
This is a question that's probably simple for most of you. I have not used Framework Manager for years, and have only been exposed to it briefly.

I have a table that looks like this:

Row         AgentID       PolicyID       PolicyType        Last Name      UpdatedDate

1              11111          12345          Regular           Smith              Jan 1, 2016
2              11111          12345          Special            Smith              Jan 5, 2016
3              22222          23456          Special            Brown              Jan 2, 2016
4              22222          23456          Special            Taylor              Jan 3, 2016

In FM, I want to somehow apply a filter to the table so the result returns only the data corresponding to the latest Updated date for an AgentID/ PolicyID combination, e.g. only rows 2 and 4.

Thanks for your help.

Hi,

Add a filter to the query subject with the expression

[UpdatedDate] = maximum( [UpdatedDate] for [AgentID], [PolicyID] )

Cheers!

MF.