2 Replies Latest reply: Sep 16, 2011 11:54 AM by Marc Livingston

# multiplying variable by -1 is causing an issue?

Can anyone tell me why this:

```=if(num(Left(glaccount,1))>=4,(\$(Sales)-\$(COGS)-\$(NetIncome)) ,
if( left(glaccount,1)='1',

(\$(Current)*(-1))

+

\$(vPrior)

,

(\$(vCurrent)*(-1))

-

(\$(vPrior) *(-1))
))
```

Returns a null result, yet this:

```=if(num(Left(glaccount,1))>=4,(\$(Sales)-\$(COGS)-\$(NetIncome)) ,
if( left(glaccount,1)='1',

\$(Current)

+

\$(vPrior)

,

\$(vCurrent)

-

(\$(vPrior) *(-1))

))
```

Returns a result?

I need \$(vCurrent) to be negative in this expression, but multiplying by -1 is causing an issue?

Edit:

This is the formula that is written to the variable:

```(sum({\$< [Fiscal Period] = {"<=\$(=Max([Fiscal Period]))"}>} if([Category Description]<>'Cash & Equivalents',(if( [Fiscal Period]=0  , 0 ,  creditamt+debitamt)  + openbalance))))
```

I tried adding the *-1 to this variable, but the expression seems to ignore it?

Prior=   -137,084

Current=   -138,833

I need

vCurrent *-1 + vPrior

138,833+(-137,084) to return the result of 1,749

but my result seems to be stuck at -137,084 no matter what I do to vCurrent

• ###### multiplying variable by -1 is causing an issue?

Hi Marc,

is it a copy and paste error that you refer to \$(Current) instead of \$(vCurrent) in the then-section?

Stefan

• ###### multiplying variable by -1 is causing an issue?

Ok I feel like an idiot now...Indeed that was the problem. Waste of a couple hours of searching for the problem. Works great now, Thanks!