Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
JanArnold
Contributor
Contributor

Substraction script returns wrong values

My substraction returns the wrong values . First orderintake culumn shows a (correct) measure and the second shows the script.

  Wrong substraction orderintake script.jpg

I use this script and tried al kinds of code to make it work, but it keeps returning the wrong values. Does anyone have an idea why this goes wrong?

I use this script code:

if(isnull([vorigemaandContractwaardemaandelijks]),[Contractwaardemaandelijks],[Contractwaardemaandelijks]-[vorigemaandContractwaardemaandelijks]) AS Orderintake_Period

 

Simply put:

if(isnull(LASTMONTH), MONTH, MONTH - LASTMONTH) AS Orderintake_Period

Labels (1)
3 Replies
Or
MVP
MVP

LastMonth looks to be zero, not null?

JanArnold
Contributor
Contributor
Author

Correct, and then it should substract 'MONTH - LASTMONTH'. It should return: -5696-0 = -5696. However it does return a 0. I'm clueless as to why.

Or
MVP
MVP

No idea what the actual underlying data is, so I couldn't begin to guess. I suggest breaking it down into two fields, one which returns Month and the other which returns lastmonth (but otherwise with the exact same formula), which should pinpoint where the issue is, and work from there.