cancel
Showing results for 
Search instead for 
Did you mean: 

Multiply Running Total Field

Former Member
0 Kudos

I'm using a running total field to count records for a subgroup. It does a distinct count on a field "for each record" and resets "on change of group". This works great. I'd like to take this value and multiply it by another normal (non running total) database field. So if the running total is field is "5" and the database field is "10" the result would be "50".

What is the best way to do this?

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi, try to do this....

Place formula 1 in the section that is doing the calculation.

Place formula 2 in the group footer where you wish to see the displayed subtotal, in your example above the 30.

Place formula 3 in the group where you wish to reset the variable; group footer #1.

Let me know if that works.

Z

Former Member
0 Kudos

correction, place the reset value in group header # 1

Former Member
0 Kudos

Formula one is in GroupFooterSection2 (Group Footer #2) and it's displaying the correct running total because I don't have it suppressed. This looks good.

I put formula two in GroupFooterSection1 (Grouip Footer #1a) and it displays nothing.

I'm not using formula three yet until I can get formula two to display correctly.

Why won't formula two display the correct value in GroupFooterSection1 (Group Footer #1a)? This is where I want to display the subtotal.

Former Member
0 Kudos

I should also mention the calculation is being made in a subgroup. I want the subtotal to display in the group (I guess this is called the parent group).

Former Member
0 Kudos

Sorry... Just found my mistake. I wasn't putting the subtotal GetValue in the correct Footer. It's working perfect now. Thanks for all of your help.

Former Member
0 Kudos

Thank you this works perfectly.

But how do I expand this to work for a subtotal? So I want to calculate the sum per subgroup of "{#RunningTotal}*DatabaseField".

So if the result of "{#RunningTotal}*DatabaseField" is 10, 10, 10 for the first group I want to calculate the subtotal as (101010) = 30.

How do I do this?

Former Member
0 Kudos

Hi.

You can try to use 3 formulas.

Formula 1 called StoreValue & place in group footer:

WhilePrintingRecords;

Global Numbervar RunningVar;

RunningVar := RunningVar+("{#RunningTotal}*DatabaseField);

RunningVar;

Formula 2 called GetValue & place in group footer:

WhilePrintingRecords;

Global NumberVar RunningVar;

RunningVar;

Formula 3 called ResetValue & place in group header:

WhilePrintingRecords;

Global NumberVar RunningVar := 0;

That should do the trick.

Former Member
0 Kudos

Having some trouble deciphering where to put the formulas. This report has three sections with their own headers and footers.

So formula one keeps a running total and stores the value in variable RunningVar. I get that. But what does formula two do? Does it just display the value in variable RunningVar?

Ultimately I would like to display this sum in GroupFooterSection1 (Group Footer #1a).

No matter where I put these formulas I can't seem to get them right.

What am I missing?

Former Member
0 Kudos

Greg,

Create a formula and disply it in you group :

{#RunningToal}*DatbaseField

Thanks,

Sastry