Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Conditional Summary Post Reply Post New Topic
Author Message
Dadee
Newbie
Newbie
Avatar

Joined: 27 Apr 2011
Location: United States
Online Status: Offline
Posts: 4
Quote Dadee Replybullet Topic: Conditional Summary
     Posted: 27 Apr 2011 at 4:17am
Hello Everyone,
 
Really hope someone can help.
 
I am working with 4 columns:
CustomerID,
StartDate(datetime)
EndDate(datetime)
Duration (in days)
 
I need to get a total of Duration. 
 
We can have multiple activites started per day, but just 1 per customer per day. Unfortunately, the data has multiple starts per day for the customer. 
 
I created 2 groups, 1 by customer, 1 by startdate (for each day).
 
I placed the details in the group header so I only see the 1st record for the day for each customer. I suppressed the details.   However, when I summaries, it includes all of the data.  I tried a formula that said if the current value = the next then 0 else duration.  But can't summaries that.
 
My data looks like this:
Cust     startdate          stopdate              duration
1           4/1/11 12:23   4/10/11 19:41      10
1           4/1/11  14:19  4/10/11 21:22      10
1           4/12/11 15:23 4/13/11 14:09      1
 
I need a total for that customer to = 11
 
Any ideas?
 
 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 27 Apr 2011 at 4:51am

You likley can use a Running Total.

CAn you show sample unsuppressed data and how you need it calculated
IP IP Logged
Dadee
Newbie
Newbie
Avatar

Joined: 27 Apr 2011
Location: United States
Online Status: Offline
Posts: 4
Quote Dadee Replybullet Posted: 27 Apr 2011 at 4:57am
The post is of un-supressed data.
Cust     startdate          stopdate              duration
1           4/1/11 12:23   4/10/11 19:41      10
1           4/1/11 14:19 4/10/11 21:22      10
1           4/12/11 15:23 4/13/11 14:09      1

I need:
The header record to to
Cust 1       Duration: 11

The end goal is to have a grand duration total that includes all customers for the month and rollup to the year.

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 27 Apr 2011 at 5:14am
so always only sum the duration once per row when the customer number and startdate (not date and time) are not the same?

Edited by DBlank - 27 Apr 2011 at 5:15am
IP IP Logged
Dadee
Newbie
Newbie
Avatar

Joined: 27 Apr 2011
Location: United States
Online Status: Offline
Posts: 4
Quote Dadee Replybullet Posted: 27 Apr 2011 at 5:18am
correct
IP IP Logged
Dadee
Newbie
Newbie
Avatar

Joined: 27 Apr 2011
Location: United States
Online Status: Offline
Posts: 4
Quote Dadee Replybullet Posted: 27 Apr 2011 at 5:34am
I figured out a way using the query to pull the 1st occurrence for a day it works.

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 27 Apr 2011 at 5:37am

or you can try this this if you need it.

create a formula field called 'rowflag' as :
totext(table. customer,0,"") + "-" + totext(table.startdate,"MM/dd/yyyy")
make a new running total
field to summarize=duration
type = sum
on change of = field (select the @rowflag formula field
reset=never for report total
or on a field change for customers or on a group for months
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