# New to QlikView

Discussion board where members can get started with QlikView.

Announcements
QlikView Fans! We’d love to hear from you.
Rules, plus terms and conditions, can be found here.
Not applicable

## 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

1 Solution

Accepted Solutions
MVP

## 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

2 Replies
MVP

## 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

Not applicable

## 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!