cancel
Showing results for 
Search instead for 
Did you mean: 

Reset Running Total

Former Member
0 Kudos

Hi All,

I have a report contains a running total,i wrote formula for this as below,i am getting result.But i need to reset the running total when it is 0

Formula :

local numberVar vararesult;

local numbervar ads ;

local numbervar atrans;

shared numbervar RT;

if ({Command.tarAds})>=({Command.actAds}) and ({Command.tarTrans})>=({Command.actTrans})

then  vararesult := {Command.tarSale}-{Command.actSale}

else (

    if {Command.tarAds}>{Command.actAds} then

   ads  := {Command.tarAds}

    else

ads :=  {Command.actAds};

   if {Command.tarTrans}>{Command.actTrans} then

        atrans :={Command.tarTrans}

    else

atrans :={Command.actTrans};

vararesult := (ads *atrans)-{Command.actSale}) ;

RT := vararesult + RT;

The actual values without running total is like this.

Opp Val

2

3

4

7

5

0

0

0

After i applied running total i am getting exact result.But i need to reset it when result  value(in formula) is 0.

I need like this.

Opp Val


2

5

9

16

21

21

0

0

0

Please suggest

Accepted Solutions (0)

Answers (1)

Answers (1)

abhilash_kumar
Active Contributor
0 Kudos

Hi Francis,

Do you want to reset the Running Total when the Running Total itself is zero or the variable 'vararesult' is zero?

If you want to reset when the variable is zero, then add this after the else loop:

if vararesult = 0 then

     RT := 0

else    

     RT := vararesult + RT;

-Abhilash