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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count only the latest record 1

Status
Not open for further replies.

AyJayEL

Technical User
Jan 30, 2001
425
GB
I need to count only the most recent records for a person where the FSM field is True. I don't want to count the record if it's true if there is a more recent record that is false. I'm sure it's simple but I'm struggling!

Person id Date FSM
1 1/1/2005 T
1 2/1/2005 F Don't count

2 2/1/2005 F
2 3/1/2005 T Count

I'm using Crystal 8.5 and an Oracle Database.

Learn something new every day *:->*
AyJayEl
 
Forgot to say there is a main group of Organisation and I want to only count the FSM = 'T' where it is the latest date. So the count for the group Organisation above would be 1.

Learn something new every day *:->*
AyJayEl
 
Insert a second group on person ID (you can suppress the group header and footer, if you wish). The date field should be sorted ascending. Then insert a running total, using count of personID, evaluate using a formula:

(
onlastrecord or
{table.personID} <> next({table.personID})
) and
{table.FSM} = "T"

Reset on change of group (Organization).

-LB
 
It works, absolutely perfectly. Thank you so much.

Learn something new every day *:->*
AyJayEl
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top