INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Need solution for Maximum and Min for Groups

Need solution for Maximum and Min for Groups

(OP)
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!

RE: Need solution for Maximum and Min for Groups

To find Maximum,

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

To find Minimum,

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

Hope this helps

RE: Need solution for Maximum and Min for Groups

(OP)
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

RE: Need solution for Maximum and Min for Groups

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?

RE: Need solution for Maximum and Min for Groups

Try the following formulas:

@initvar

whileprintingrecords;
numbervar max_state:=0;
numbervar tempvar:=0;


Place it in GH1 and suppress it.


Maximum_State

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;


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


RE: Need solution for Maximum and Min for Groups

(OP)
I had to make one adjustment to what you posted, using Count instead of Sum but this worked exactly as I needed. Thank you!

RE: Need solution for Maximum and Min for Groups

(OP)
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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close