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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

if statement in load script

Hi,

what is not correct ?

LOAD
Hierarchy,
NetValue,
if((BP-Account= 'Corporate'), 1), if((BP-Account= 'Key'), 2),
if((BP-Account= 'Standard'), 3), if((BP-Account= 'Private'), 4)
as CorpAccGrID
from data


Thanks



1 Solution

Accepted Solutions
Not applicable
Author

Hi,

Thanks for all help .

That works.

View solution in original post

6 Replies
Not applicable
Author

Else part missing from your expression

Not applicable
Author

Try this

if

((BP-Account= 'Corporate'), 1, if((BP-Account= 'Key'), 2,if((BP-Account= 'Standard'), 3, if((BP-Account= 'Private'), 4

))))

as

CorpAccGrID





Not applicable
Author

Hi,

Thanks

you mean

LOAD
Hierarchy,
NetValue,
if((BP-Account= 'Corporate'), 1) else if((BP-Account= 'Key'), 2) else
if((BP-Account= 'Standard'), 3) else if((BP-Account= 'Private'), 4)
as CorpAccGrID
from data


Anonymous
Not applicable
Author

Try like this


If([BP-Account]='Corporate',1,
If([BP-Account]='Key',2,
If([BP-Account]='Standard',3,
If([BP-Account]='Private',4)))) as CorpAccGrID


In all other cases CorpAccGrID will be Null.

Rgds,
Artjoms

Anonymous
Not applicable
Author

else part is optional in If statement

Rgds,
Artjoms

Not applicable
Author

Hi,

Thanks for all help .

That works.