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

Subtracting two Max Summaries within same section of report

Status
Not open for further replies.

lcumbie

Programmer
Sep 30, 2010
3
US
Using a COTS database as the source, I am forced to use Max summaries to obtain values for a repeating group in a subreport. These function well.

The problem is that I need to subtract one of the Max summaries from the other and display it within the same section of the report.

Any ideas?


 
Maximums of what? At what group level? (Please identify the field(s) you are grouping on and the location of the maximums. Are they simple inserted maximums or formulas? If formulas, please show the content.

-LB
 
If you're taling about a summary value based on a group, it is only usable within that group.

Running totals will allow you to collect a particular set of values for the whole report. You pre-define them with a formula.

If you're not already familiar with Crystal's automated totals, see FAQ767-6524.


[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 11.5 with SQL and Windows XP [yinyang]
 
COTS database stores 'custom' field values in a single field regardless of type. Used SQL query to extract values for particular fields for particular cases. As a result, obtained repeating values for each iteration within case. Iteration is only grouping.

Placed fields in Details section. Had to create formula for most of them (IF {Command.Name}='MedLienServToDate1' then
If IsDate({Command.value}) then datevalue({Command.Value})
else cdate(1950,1,1)) to convert from string. Also had some numerics which are crux of issue here.

Used Maximum summary type in Group Footer to cull out desired value from repeated iterations.

So, Max of(AmtBilled) and Max of (AmtDue) display. Tried to create simple formula f(AmtPaid) subtracting them but 0.00 value. Tried Max of (AmtPaid) but gave me Max of (AmtBilled), Min gave me Max of (AmtDue). Tried to create formula embedding Summary in it (Maximum ({@fAmountBilled}) - Maximum ({@fAmtDue})) without success.

Sum of (AmtPaid) did equal Sum of (AmtBilled) - Sum of (AmtDue) in Report Footer.

Found that if I used second Sum of (AmtPaid) within Group Footer, it successfully subtacted and displayed Max of (AmtBilled) - Max of (AmtDue).

Don't know why it worked.
 
You need to add the group condition in your formula:

Maximum({@AmtDue},{table.groupfield}) - Maximum({@AmtBilled},{table.groupfield})

In the future, please show actual formulas, not descriptions of them.

-LB
 
Will do. Thanks for all your help (and patience).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top