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

Error in expression: If takes 2-3 parameters

Hi,

Hope that some one can help me with this. I can't seem to figure out what why this fails:

[TEST]:

Load

[Supplier Id],

[Invoice Year],

if( ScoreTotal >= $(vAScore) , 'A' , 'B') As [Test],

ScoreTotal as [Score - Total]

Resident [TEMP Total Score];

I keep getting this error:

Error in expression:

If takes 2-3 parameters

[TEST]:

Load

[Supplier Id],

[Invoice Year],

if( ScoreTotal >= 17,59495 , 'A' , 'B') As [Test],

ScoreTotal as [Score - Total]

Resident [TEMP Total Score]

Hope that there is a genius out there 😉

Thanks in advance

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Yes, I think the problem ist the decimal separator of your vAScore variable.

Do you use a comma as decimal separator like

SET DecimalSep=',';

?

Try using $(#vAScore) instead in your if() statement.

View solution in original post

4 Replies
Not applicable
Author

Is there anyway you can add the .qvw document?  Might be useful if we could have a play with it directly.  I'm wondering if it's got to do with the "," in the variable.  Have you tried puting the variable within single quotes? '$(vAScore)'

Cheers,

Emma

swuehl
MVP
MVP

Yes, I think the problem ist the decimal separator of your vAScore variable.

Do you use a comma as decimal separator like

SET DecimalSep=',';

?

Try using $(#vAScore) instead in your if() statement.

Clever_Anjos
Employee
Employee

Only 2 options

if( ScoreTotal >= $(vAScore) , 'A' , 'B') As [Test],

Or ScoreTotal is empty (not present in your table) or $(vAScore)  is empty, could you put here the SET/LET command that created $(vAScore) ?

Not applicable
Author

The problem was with the variable being formated as #,### insted of the script native #.### i solved it with:

if( ScoreTotal >= Num#($(vAScore)) , 'A' , 'B') As [Test],

Many thanks for your valuable input.