Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
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
swuehl
MVP
MVP

Hi Marc,

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

Stefan

View solution in original post

2 Replies
swuehl
MVP
MVP

Hi Marc,

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

Stefan

Not applicable
Author

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!