Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Count Most Recent Event Post Reply Post New Topic
Author Message
walkitinkid
Newbie
Newbie


Joined: 16 Jun 2011
Online Status: Offline
Posts: 16
Quote walkitinkid Replybullet Topic: Count Most Recent Event
     Posted: 30 Jun 2011 at 10:52am
Hi All
 
I Have a table that looks like this
date     Apartment #     Event
1/5/10     1     vacant
1/6/10     1     Move-in
1/7/10     1     vacant
1/3/10     2     move-in
1/4/10     2     vacant
1/5/10     2     cleaning
1/1/10     3     Move-in
1/2/10     3     cleaning
how do I get a count of the most recent event?
 
ie how many apts for the most recent event
Vacant,Cleaning,Move-in
1,2,0
 
 
 
IP IP Logged
kostya1122
Senior Member
Senior Member
Avatar

Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
Quote kostya1122 Replybullet Posted: 30 Jun 2011 at 12:38pm
not sure what you mean by most resent, but you could
create a formula like
if date(field) in date(YYYY,MM,DD) to date(YYYY,MM,DD) then count(event(field))

IP IP Logged
walkitinkid
Newbie
Newbie


Joined: 16 Jun 2011
Online Status: Offline
Posts: 16
Quote walkitinkid Replybullet Posted: 30 Jun 2011 at 4:03pm
that wont work actually, there are 1200 apartments, some have been moved into and out of before they would even fall into the date range. I need to know what happened last for each unit and then get a count.

I need something like
maximum(datefield) and {eventfield} = "move-in"

not sure of the syntax though

Edited by walkitinkid - 30 Jun 2011 at 4:05pm
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 05 Jul 2011 at 4:08am
one way is to use a running total to get the count of move ins (or any event)
where you might run into an issue is if two events happende on the saem ady for the same apt.
group on apt field
create a running total
name =move_in_count
field to sumamrize = apt field
type = count
evaluate = use a formula
event='Move-in' and maximum(table.date,table.apartment)=table.date
reset=never
place in group footer
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum