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

Invalid Expression in data load script

Hello All, I dont know why get a error when try Load this Script:

"

Budget:
LOAD DISTINCT
ApplyMap('Mapeo_Hi',AccountAct) As Account,
if (AccountAct ='Ton', sum(ValorActBN), Sum(ValorActBN)*1000 ) AS Valor,
FROM [lib://Hi\0619+\*.xlsx](ooxml, embedded labels,header is 1 lines,table is EERR_Norte)
GROUP BY ApplyMap('Mapeo_Hi',AccountAct),Mid(FileName(),FindOneOf( FileName(), '_')+1, 4) ,Capitalize(Mid(FileName(),1, FindOneOf( FileName(), '_')-1));

"

I get a "Invalid expression" whe try to Load.

I know that the problem is this line:  "if (AccountAct ='Ton', sum(ValorActBN), Sum(ValorActBN)*1000 ) AS Valor, "

If I reemplace it for: " Sum(ValorActBN)*1000 AS Valor," the load is correct, but I need to *1000 all the data except the AccountAct named "Ton"

Any one can Help? Thx for advance.

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I believe it should be:

Sum(ValorActBN * if(AccountAct ='Ton', 1, 1000))  AS Valor,

-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com

View solution in original post

4 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I believe it should be:

Sum(ValorActBN * if(AccountAct ='Ton', 1, 1000))  AS Valor,

-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com

Bukan4x4
Contributor III
Contributor III
Author

Thanks Rob, Now the load don't show any error, but the expression is not calculated, all AccountAct are in empty in the database. Any idea?

Jorge

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Not sure. Can you upload a sample?

Bukan4x4
Contributor III
Contributor III
Author

Hi Rob, I've had a mistake in my code. You are right the solution works perfect.

Thanks very much!

Regards

Jorge