Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have the following statement that don't works in my load script:
-1 * sum(
CASE WHEN amount <0 AND transaction_type_code = 'cashin' THEN amount
WHEN amount >0 AND transaction_type_code = 'revert' THEN amount
ELSE 0
END
)
However when I do this I get the error "Error in expression: ')' expected". Is there a way to fix this?
This statement looks like it's SQL. It won't work in Qlik load statements because it's not valid Qlik syntax. Qlik does have a CASE statement but it works differently (and is used for different use cases): https://help.qlik.com/en-US/qlikview/April2019/Subsystems/Client/Content/QV_QlikView/Scripting/Scrip...
You can do this calculation in your SQL query and load the result if that's feasible. Alternatively, you can re-write your statement using Qlik syntax, for example with something along the lines of (note: not necessarily correct syntax since I'm not able to test it):
-1 * (sum(
if(amount <0 AND transaction_type_code = 'cashin',amount,
if(amount >0 AND transaction_type_code = 'revert',amount,
0))
))
thanks, it seems to work!