Hello,
I have a data set that I need to flag the records based on (4) different criteria type. One of the (4) criterias contain 2 parameters.
This is the formula I am currently using.
"IF [Price]=<75 OR [Current Stock]/[Original Stock]=<.8 OR [Original Price]-[Current Price]=>2 OR [Price] BETWEEN 70 AND 80 AND [MTD Loss] =>1,000,000) then "Review" else "OK"
Where is my formula going wrong? Thank you,
try
IF [Price] <= 75
OR ([Current Stock] / [Original Stock]) <= 0.8
OR ([Original Price] - [Current Price]) >= 2
OR ([Price] >= 70 AND [Price] <= 80 AND [MTD Loss] >= 1000000)
THEN "Review"
ELSE "OK"
ENDIF
In Alteryx formulas, you must use the standard comparison operators (<=, >=, <, >, =). Alteryx does not recognize =< or => as valid operators, and you also need to pay attention to parentheses when mixing AND and OR.
Here’s what’s likely going wrong in your expression:
IF
[Price] <= 75
OR ([Current Stock] / [Original Stock]) <= 0.80
OR ([Original Price] - [Current Price]) >= 2
OR (
[Price] >= 70
AND [Price] <= 80
AND [MTD Loss] >= 1000000
)
THEN
"Review"
ELSE
"OK"
ENDIF
Key Points
This should fix any syntax errors and ensure Alteryx evaluates your conditions correctly.
Thanks for the reply, binuacs and apologies on the late reply. The syntax you provided is correct but its not giving me the results I am looking for. Attached is an example data set where all (4) criteria are met but nothing is showing up in the true anchor. Can you please take a look and let me know if I am missing anything? I appreciate your efforts.
Sometimes it is simpler to have 4 different formulas each of each of the conditions.
The minute that you will have 2 or 3 conditions that are meeting the logic then the formula will foul as it is expecting that only one condition can be true to one row.
Try to split it to 4 rows
IF [Price] <= 75
THEN "Review"
ELSE "OK" ENDIF
IF [([Current Stock] / [Original Stock]) <= 0.8
THEN "Review"
ELSE [Fieldname] ENDIF
IF [([Original Price] - [Current Price]) >= 2
THEN "Review"
ELSE [Fieldname] ENDIF
IF ([Price] >= 70 AND [Price] <= 80 AND [MTD Loss] >= 1000000)
THEN "Review"
ELSE [Fieldname] ENDIF
.
The OR is aim to check if the current row is meeting only one of the OR conditions. So the minute that one row meets more than one condition it will foul.
User | Count |
---|---|
106 | |
82 | |
70 | |
54 | |
40 |