Forcing Calculation on zeros if another variable is non-zero
Posted: Mon Feb 06, 2017 10:08 am
Hi all,
I'm trying to create a running total.
My issue is that if a particular week has zero payment, the calculation is ignored, so I get no value in the running total.
What I would like is for the calculation to occur only if there is a movement that week or if the previous week's running total is non-zero.
I'm aware that ViewExtractSkipZeroesSet will force the process the run for all values, but then the computation time makes the process unusable.
Is there some way to run the data tab dependent on multiple inputs?
I'm trying to create a running total.
My issue is that if a particular week has zero payment, the calculation is ignored, so I get no value in the running total.
What I would like is for the calculation to occur only if there is a movement that week or if the previous week's running total is non-zero.
I'm aware that ViewExtractSkipZeroesSet will force the process the run for all values, but then the computation time makes the process unusable.
Is there some way to run the data tab dependent on multiple inputs?
Code: Select all
#This line from prolog tab for context
vPriorWeek=ATTRS('TaxWeek',pTaxWeek,'Prior Tax Week');
#Process should only run for one week at a time. To add to view in prolog tab after troubleshooting
IF (TaxWeek@<>pTaxWeek);
ITEMSKIP;
ENDIF;
#Previous balance
PrevBal=CellGetN('CumulativeCube',vPriorWeek,Contractor,'Holiday Cumulative');
#This Week's movement
HolidayCalcPaid=CellGetN('MainCube','Actual','DataSource',Pay_Frequency,Scheme,Account_Manager,BDM,Agency,IC,PC,Contractor,TaxWeek,'Holiday Paid');
HolidayCalcRetained=CellGetN('MainCube','Actual','DataSource',Pay_Frequency,Scheme,Account_Manager,BDM,Agency,IC,PC,Contractor,TaxWeek,'Holiday Retained');
Movt=HolidayCalcRetained-HolidayCalcPaid;
#Attempt to
IF(Movt=0 & PrevBal=0);
ITEMSKIP;
ENDIF;
CellPutN(Movt,'CumulativeCube',TaxWeek,Contractor,'Holiday Movt');
CurrentBal=PrevBal + Movt;
CellPutN(CurrentBal,'CumulativeCube',TaxWeek,Contractor,'Holiday Cumulative');
#Filling Main with same cumulative value
#CellPutN(CurrentBal,'Maincube','Actual',vDataSource,Pay_Frequency,Scheme,Account_Manager,BDM,Agency,IC,PC,Contractor,TaxWeek,'Holiday Cumulative');