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

Help! subTotal of running total fields

Status
Not open for further replies.

eboyjohn

Technical User
Jan 15, 2004
1
0
0
US
We have three sale teams. They are selling three products in five cities. I am developing a monthy report. The report style is:

Product1 Product2 Product3 Total

Team1 x1 x2 x3 x4

Team2 y1 y2 y3 y4

Team3 z1 z2 z3 z4

Summary: subTOTAL

I have developed three running total fields x4, y4, and z4. The group field is Month. The problem is I can't get the correct result of formula subTOTAL. Here is how I define the formula subTOTAL:
---------------------------------------
WhilePrintingRecords;
NumberVar subTotal;

if {#x4} <> 0 then subTotal := subTotal + {#x4};

if {#y4} <> 0 then subTotal := subTotal + {#y4};

if {#z4} <> 0 then subTotal := subTotal + {#z4};

subTotal;
----------------------------------------

Did I do something wrong? or do I have better solution? Any suggestion is great appreciated!
 
Not sure,

But shouldn't your Subtotal be:

{#x4} + {#y4} + {#z4}

I think your formula would return the last running total not equal to zero.

I hope this helps,
Terry

 
I am not sure why you made those three running total fields, and you haven't specified how your final subtotal number is wrong. But, in general, for the total of a running total field it is usually easiest to create another running total field that doesn't reset.

Lisa
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top