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

Formula Field Total

Status
Not open for further replies.

dyan24

Technical User
Sep 7, 2004
56
CA
I have a formula field called TotUnits with this code:

WhilePrintingRecords;
NumberVar UnitAmount;
UnitAmount := UnitAmount + {@Amount};

And gets printed at the group footer with this code:
WhilePrintingRecords;
NumberVar UnitAmount;

And this is get reset everytime the group header change

WhilePrintingRecords;
NumberVar UnitAmount;

But i also need to use the total Unitamt for my formula for the next column and i don't know how. Please HELP....

This is the output that i would like to happen

Amt Allocation Value(%)
----- -------------------
3225 3.63% (this is (3225/88,914)*100)
9077 10.21%
14044 15.80%
5803
22788
1551
31833
593
--------
88,914 ==> this is the Unit Amount
 
Not sure why you are using variables to come up with your total, can you not just insert a simple sum()?

If so then your % of total is just {@Amount}/Sum({@Amount}. You can still place this in the details section.



Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
askdon@srhconsulting.com
 
Simple sum() will not work for my UnitAmount since the amount are not distinct on my sql results, hence i am using a formula field.
 
dgilz nailed this.

Create a formula and place it alongside your @amount formula:

If Sum({@Amount},{table.groupfield}) <> 0 then
({@Amount}/Sum({@Amount},{table.groupfield}))*100

-k
 
The amount are not distinct has no bearing.

If you wish to speak of technical aspects, post what's in the formula.

If it's in the details, use a conditional so that it always returns a value, such as:

if not(isnull({table.value})) then
{table.value}
else
0

Distinct values have nothing to do with this.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top