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

Need solution for Maximum and Min for Groups

Status
Not open for further replies.

chrijon

Technical User
Jul 29, 2015
4
0
0
US
My data contains records with a Date Created field and a State field among others. I need Crystal to give me the number of records for a particular state by date and then figure the Max and Min of that set of data. The numbers found below next to each date are a Summary Field, counting records for each date. It seems like a simple summary field for Max and Min would work, but it brings back a LARGE number so I've almost accepted defeat on that front. Here's where I'm at and struggling.


GH1 AL
GH2 7/8/2015 6,702.00
GH2 7/12/2015 3,173.00
GH2 7/13/2015 7,907.00
GF1
GH1 CA
GH2 7/8/2015 10,297.00
GH2 7/12/2015 5,178.00
GH2 7/13/2015 11,355.00
GF1
GH1 CO
GH2 7/8/2015 1,340.00
GH2 7/12/2015 585.00
GH2 7/13/2015 1,365.00
GF1


I would like to be able to show Max and Min for each data set. For instance AL would show Max: 7,907 and Min: 3,173
Any help you can provide would be appreciated! Thank you!

 
To find Maximum,

Insert-->Summary
In [tt]Choose the field to summarize[/tt], select your number field
In [tt]Calculate this summary[/tt], select Maximum
In [tt]Summary Location[/tt], select group #1 State field

To find Minimum,

Insert-->Summary
In [tt]Choose the field to summarize[/tt], select your number field
In [tt]Calculate this summary[/tt], select Minimum
In [tt]Summary Location[/tt], select group #1 State field

Hope this helps
 
Thanks for the quick reply! Unfortunately, I've tried that method. Instead of getting the Maximum for the three data pieces above, I get what i'm assuming is the maximum of tickets among the data. Here is what is coming back when following that method for Maximum. Any idea why this is or how to avoid this?

GH1 AL
GH2 7/8/2015 6,702.00
GH2 7/12/2015 3,173.00
GH2 7/13/2015 7,907.00
GF1 62,249,106.00

GH1 CA
GH2 7/8/2015 10,297.00
GH2 7/12/2015 5,178.00
GH2 7/13/2015 11,355.00
GF1 62,249,109.00

GH1 CO
GH2 7/8/2015 1,340.00
GH2 7/12/2015 585.00
GH2 7/13/2015 1,365.00
GF1 62,248,982.00

 
Sorry, I didn't pay enough attention to your post before posting my reply. Didn't see the fact that the number field is in GH2. My post above will work only if the amount is in Details. Is the number field a calculated value?
 
Try the following formulas:

@initvar

[tt]whileprintingrecords;
numbervar max_state:=0;
numbervar tempvar:=0;[/tt]

Place it in GH1 and suppress it.


Maximum_State

[tt]whileprintingrecords;
numbervar tempvar;
numbervar max_state;

if Sum ({Sheet1_.AMOUNT}, {Sheet1_.DATE}, "daily")>tempvar then
tempvar:=Sum ({Sheet1_.AMOUNT}, {Sheet1_.DATE}, "daily");
max_state:=tempvar;
max_state;[/tt]

Place it in GH2 and also in GF1. Suppress the formula placed in GH2.


 
I had to make one adjustment to what you posted, using Count instead of Sum but this worked exactly as I needed. Thank you!
 
Your help has been much appreciated, any idea how to accomplish the same thing for Minimum? I tried applying the same logic but got the same number as Maximum_State.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top