Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is it possible to pull the most recent record for an employee

Status
Not open for further replies.

Hanzelmans

Technical User
Dec 3, 2003
20
US
If we are writing a Report Studio report and it is currently returning five rows of data for Employee A, would it be possible to only return the record with the most recent date and exclude the other four records?

Steve Hanzelman
Milton Hershey School
 
Yep,

build a dataitem : rank([date] for [employee])
use this in a detail filter , like:
rank([date] for [employee]) = 1
with the filter property set to 'after auto aggregation'

Ties Blom

 
Hi Ties,
Thanks for your response.

I am having problems with the Rank function. I cannot get it to rank the individual employee data. It will rank the date for the entire data set.

Thanks,
Steve

Steve Hanzelman
Milton Hershey School
 
That is strange. I tested my suggestion prior to posting and it worked out for me. In my case both date and employee where non-facts, identifiers as such. My test database was on a SQL 2005 server and Cognos 8.1 the reporting tool.

Ties Blom

 
Steve,
Create a calculated column, named MaxRec, as " MAXIMUM([date] for [employee]) ".
Then create a filter: MaxRec = [date]

This will ony show those row(s) where the [date] equals the hightest date for the [employee].

SLN
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top