Print Page | Close Window

SUM FORMULA

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=6312
Printed Date: 13 May 2024 at 11:16am


Topic: SUM FORMULA
Posted By: 3jmj
Subject: SUM FORMULA
Date Posted: 11 May 2009 at 1:23pm
< ="Content-" content="text/; charset=utf-8">< name="ProgId" content="Word.">< name="Generator" content="Microsoft Word 12">< name="Originator" content="Microsoft Word 12"><> PLEASE HELP!!! THIS IS MY REPORT AND BELOW ARE WHAT I NEED HELP ON:

< ="Content-" content="text/; charset=utf-8">< name="ProgId" content="Word.">< name="Generator" content="Microsoft Word 12">< name="Originator" content="Microsoft Word 12">
<>

DATE:    WRK CTR: JOB:  OP NO:  LOT: SETUP: HRS: VAR:  RUNNING?    EARNED(LOSS)

4/29/09 1.110.01     0002141  10     001   25.00 7.00   18.00    NO       1080.0

4/30/09 1.110.01    0002141  10      001   25.00  1700   8.00    YES     480.00

 

4/29/09 1.115.11     0002093 10     001    12.00  2.00   10.00    NO      500.00

4/30/09 1.115.11     0002093 10     001   12.00   8.00   4.00     NO      200.00

 

4/28/09 1.115.04   0001516  10      002   12.00   4.00   8.00     NO     400.00    

4/29/09 1.115.04   0001516  10      002  12.00    5.50   6.50     NO      325.00

4/30/09 1.115.04   0001516  10      002  12.00    15.50   (3.50)   YES     (175.00)

 

4/29/09 1.130.17   0001278 10      005  14.00    2.00   12.00     NO     540.00

4/29/09 1.130.17   0001278 10      005  14.00    5.00   9.00     NO     405.00

 

Having this report, please help me accomplish two formulas that I tried all kinds it still did not give me the right answer:

 

First formula I need is to add only the last line per group under column Earned(Loss):

480.00 + 200.00 + (175.00) + 405.00 = 910.00

 

Second formula that I need help on is to add only the last line of each group under column Earned(Loss) but it has to look at the column Running? First and only pick the YES answer then on same line under column Earned(loss) add them up.

480.00 + (175.00) = 305.00

 

NOTE:  BOTH OF THEM HAS TO BE PUT IN REPORT FOOTER.  I HAVE REPORT FOOTER A AND B TO PUT THEM IN THERE.

   



Replies:
Posted By: lockwelle
Date Posted: 12 May 2009 at 6:59am

create formula

shared numbervar formula1;
shared numbervar formula2;
 
if {table.running} = "YES" then
 formula2:=formula2 + {table.earnloss};
 
formula1 :=formula1 + {table.earnloss};
 
place the formula in the group footer, this will only look at the last record of the group above.
 
HTH


Posted By: 3jmj
Date Posted: 12 May 2009 at 10:37am
I think the formula works but it is giving me wrong answers:
how can i send you my report so you will be able to see it?


Posted By: 3jmj
Date Posted: 12 May 2009 at 11:16am
please help I would like to send you my report, i am so frustratedCry


Posted By: lockwelle
Date Posted: 13 May 2009 at 6:41am

Relax, figuring out how to 'see' what Crystal is doing and correct is what makes us valuable.

In the formula that I wrote, it will only display the results of formula1, which is probably not what you want/expect.
 
Create another formula that just displays the values, they are really simple and would look like:
shared numbervar formula1
 
and the other would be:
shared numbervar formula2
 
place these on the report, and see if they display the values that you expect.  If you really want to see if the formulas are working, move them to the detail section and watch as they increment...perhaps one of them is wrong and is not doing what you want, but then you will be able to see the pattern(hopefully) and correct it.
 
as a note, if you want to hide the values in the first formula that I responded with, add a line and just have a empty string in it (""). Crystal displays the last printable item in a formula, regardless of what it is, so "" just prints that and 'hides' the results of the formula, which would/could appear to be complete gibberish as far as the user is concerned.
 
Hope this helps...really, relax, we all have been frustrated and confused and at times completely pissed off at Crystal. 



Print Page | Close Window