Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I would recommend using RangeSum() as your condition like this:
WHERE RangeSum(Amount1, Amount2) > 100;
Can you elaborate on what you mean by "does not seem to work"? Not filtering, error message?
-Rob
Try this
Table1:
LOAD
Field1,
Field2,
Amount1,
Amount2
WHERE Amount1 + Amount2 > 100;
LOAD
Field1,
Field2,
Amount1,
Amount2
FROM [lib://YourDataFolder/YourFile.qvd] (qvd);
Hi @TimeToQlik , it can be differents things :
Maybe Amount fields are not recognized as numbers, so you can force their interpretation. NUM#
Maybe you can put the add in parenthesis to secure the comparation against the sum of both fields ()
Table1:
LOAD
Field1,
Field2,
Amount1,
Amount2
FROM [lib://YourDataFolder/YourFile.qvd] (qvd)
WHERE (num#(Amount1) + num#(Amount2) ) > 100;
I would recommend using RangeSum() as your condition like this:
WHERE RangeSum(Amount1, Amount2) > 100;
Can you elaborate on what you mean by "does not seem to work"? Not filtering, error message?
-Rob
Hi @TimeToQlik,
Can you please share your current real Load Script instead of a concept code?
Regards,
Mark Costa
Read more at Data Voyagers - datavoyagers.net
Follow me on my LinkedIn | Know IPC Global at ipc-global.com
I really appreciate you all for your quick response. I'm excited to be a part of this community already.
I found the problem with my code.The issue seems to be with one of the amount fields being NULL. While I gave only two amount fields in my example, in my actual script I have 9 columns and one of them is calculated using a left join. This is causing the field to have NULL in some cases. I thought I handled the NULL using NullAsValue, but it looks like it does not work if the field is used as part of an expression.
Here is the example code, much closer to my scenario:
Using COALESCE fixed the issue, but please let me know if there is a more effective way to handle the issue or to handle NULLs in general. Like I mentioned, I'm new to Qlik and I'm open for any feedback. Thank you all very much once again!
Hello Rob, Thanks for your response! I should've been clearer. There was no error message, it was filtering the data incorrectly.
I saw your solution after I handled the NULL using COALESCE explicitly, but using RangeSum would've worked too. I noticed that the funtion RangeSum replaces a expression/field with zero if it is NULL.
Yes, that's the advantage of RangeSum(). BTW, if you were going to use Coalesce() in this situation I would recommend using Alt() instead, as Alt is Coalesce for numbers.
-Rob
Thanks again Rob, didn't know about Alt. I'll make the change.