Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Community is experiencing an influx of spam. As we work toward a solution, please use the 'Notify Moderator' option on the ellipsis menu to flag inappropriate posts.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Malformed If statement

AhanaR
7 - Meteor

Could someone please tell me what I might be doing wrong here?

 

I'm trying to write an if statement to calculate price gain and is being prompted with an error as below :

 

AhanaR_0-1677571437576.png

 

Formula is :

 

IF [Document Currency]='USD' then(([Unit Price In Backlog]-[ASP (USD)])*[Backlog Quantity in Base Unit])elseif( ([Unit Price In Backlog]-[ASP (Local) ])*[Backlog Quantity in Base Unit])
ENDif

 

 

Dataset used :

 

MaterialUnit Price In Backlog Document Currency  ASP  (Local)   ASP (USD) Backlog Quantity in Base Unit
ABC                                                       600.00 USD                  406.22                                      406.22263
BYA                                                   4,000.00 INR              3,467.13                                  3,467.134
SJR                                                       120.00 USD                     90.00                                         90.0073
QVY                                                       210.00 SGD                  180.50                                      180.5036

 

3 REPLIES 3
ShankerV
17 - Castor

Hi @AhanaR 

 

The data type of the column might be in string.

Please convert to Integer type or Double and check.

 

ShankerV_0-1677572043592.png

 

ShankerV
17 - Castor

Hi @AhanaR 

 

Please find the sample use case.


IF [ Document Currency ]="USD"
Then(([Unit Price In Backlog]-[ ASP (USD) ])*[Backlog Quantity in Base Unit])
ELSE (([Unit Price In Backlog]-[ ASP (Local) ])*[Backlog Quantity in Base Unit])
ENDif

 

ShankerV_0-1677572394573.png

 

Many thanks

Shanker V

AhanaR
7 - Meteor

Thank You so much Shanker

Labels