Maximum value of group

I have a report with a group "X".  I have a count of field "Y" added at the group "X" header.  Is there a way that I can find the maximum count of the grouped fields?

I tried
Maximum(Count ({RPT521_20081117.TDL TRAN TX ID}, {RPT521_20081117.CODER NAME}))

but am getting an error that the Count can not be summarized.
gdspeareAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mlmccCommented:
It can't be.

You will have to do a manual max.

In the report header add a formula
WhilePrintingRecords;
Global NumberVar MaxCount := -1;
''

In the group header or footer
WhilePrintingRecords;
Global NumberVar MaxCount;
If MaxCount < Count({({RPT521_20081117.TDL TRAN TX ID}, {RPT521_20081117.CODER NAME})) then
   MaxCount := Count({({RPT521_20081117.TDL TRAN TX ID}, {RPT521_20081117.CODER NAME}))
''

In the report footer
WhilePrintingRecords;
Global NumberVar MaxCount;
MaxCount

mlmcc
0
gdspeareAuthor Commented:
mlmcc -

Thanks for responding.  I think I have followed your instructions.  I have added 3 formulas to the report.  Formula 1 is in the report header, formula 2 in the group header, and formula 3 in the report footer.

What formula 2 is doing, however, is looking at the row above it and if the count of items is greater than the row above it is adding that count (if row 2 is more than row 1 row 2 value displays).  On the other hand if the second row is smaller than the first a zero is displaying.

Formual 3 is pulling the max for the entire group.

0
mlmccCommented:
For the formula 2 it is just finding the max count for the report.

You still need to use your count formula for the count for the group.

mlmcc
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

gdspeareAuthor Commented:
mlmcc -

Sorry for dense about this topic, but...

I tried to add a summary on @Max_Count_2 (my second formula) as well as creating a formula, but I am getting back to the original error that the formula can not be summarized.

I have added my 3 formulas below to confirm that I followed your first set of instructions.

Thanks,
David
@Max_Count_1 - LOCATION: REPORT HEADER
WhilePrintingRecords;
Global NumberVar MaxCount := -1;
 
@Max_Count_2 - LOCATION: Group 1 header
WhilePrintingRecords;
Global NumberVar MaxCount;
 
If MaxCount < Count ({RPT521_20081117.TDL TRAN TX ID}, {RPT521_20081117.CODER NAME}) then
  MaxCount := Count ({RPT521_20081117.TDL TRAN TX ID}, {RPT521_20081117.CODER NAME}) ELSE
{@Max_Count_3}
 
@Max_Count_3 - LOCATION: REPORT FOOTER
WhilePrintingRecords;
Global NumberVar MaxCount;
MaxCount

Open in new window

0
mlmccCommented:
Are you trying to display the MaxCount in each group header?


@Max_Count_2 - LOCATION: Group 1 header
WhilePrintingRecords;
Global NumberVar MaxCount;
 
If MaxCount < Count ({RPT521_20081117.TDL TRAN TX ID}, {RPT521_20081117.CODER NAME}) then
    MaxCount := Count ({RPT521_20081117.TDL TRAN TX ID}, {RPT521_20081117.CODER NAME});
MaxCount

What values are being displayed?

mlmcc
0
gdspeareAuthor Commented:
I am going to attempt to add it to multiple groups, but right now i'm just trying to figure it out.
I have attached a screenshot (.pdf) of what my @max_count_2 formula is doing.


coder-productivity-v1-11.17.2008.pdf
0
mlmccCommented:
Does my formula give the same result?

mlmcc
0
gdspeareAuthor Commented:
Yes,  using

If MaxCount < Count ({RPT521_20081117.TDL TRAN TX ID}, {RPT521_20081117.CODER NAME}) then
  MaxCount := Count ({RPT521_20081117.TDL TRAN TX ID}, {RPT521_20081117.CODER NAME})

as @Max_Count_2 produces the same result
0
mlmccCommented:
Can you upload the report?

Make a copy and change the extension to txt

mllmcc
0
gdspeareAuthor Commented:
Not quite sure how to save a cr as a txt file...
0
mlmccCommented:
Make a copy.  Then change the extension to TXT.  It is still a report file but the extension is TXT.
EE doesn't accept RPT files

mlmcc
0
gdspeareAuthor Commented:
0
mlmccCommented:
It looks like it should work.

I made a minor change to the 2nd formula

See if that works

mlmcc
Copy-of-Coder-Productivity-V1-11.txt
0
gdspeareAuthor Commented:
mlmcc -

I really appreciate you help on this. I actually had already returned the same results as your adjustment.  What the change does is keep a running log of the maximum number up to that point in the group.  I want to return the maximum number.

If you look at the attached you will will understand what I mean.  I wanted the value of 1,580 to be returned all the way down.
Unless the answer is obvious to you at this point, I am just going to do the calculation in my view on the server as a subquery.

David
copy-of-coder-productivity-v1-11.pdf
0
mlmccCommented:
The way it is calculated you will only have the maximum value after the report is run.  If you need it before that then you need to use a summary function or do it in the SQL

mlmcc
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
gdspeareAuthor Commented:
Excellent ideas.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.