Have a little bit of a roadblock on one last piece. I relatively new to Alterxy and tried searching for an answer before posting.
Here's my error any help would be appreciated.
I have my no/ no working but believe there is an error in my Else IF. I need to have an output that shows datetimenow minus order date if greater than 3.
What am I missing...Thanks
IF [New Conf Date]='NO' THEN 'NO'
ELSEIF DateTimeNow() - [Order Date]>3 THEN 'Inprocess'
ELSE 'Maybe'
ENDIF
Solved! Go to Solution.
You will probably want to use DateTimeDiff(DateTimeNow(),[Order Date],"days") > 3 rather than just using a minus sign. Can you try that and see how it goes?
Getting closer, Thank you - Updated
Issue is that order date vs today is some that are greater than 3 days reporting 'NO'
No 'Inprocess' being reported when data has plently of 3 days and less
IF [New Conf Date] ='NO' THEN 'NO'
ELSEIF DateTimeDiff(DateTimeNow(),[Order Date],"days") >3 THEN 'Maybe'
ELSE 'Inprocess'
ENDIF
According to the IF statement, rows having [NewConfDate]='NO' will evaluate to 'NO' ... and that will happen regardless of the order date, which is in the "else" portion of the statement...
For things unexpectedly showing as 'Inprocess'... you could generate a new column using the Formula tool with:
DateTimeDiff(DateTimeNow(),[Order Date],"days")
... just in order to see what the values are, which is helpful for debugging... if (for instance) they're all negative numbers, then just reverse the order of the dates:
DateTimeDiff([Order Date],DateTimeNow(),"days")
Hope that helps!
Thank You for previous solution, have one more that spent the last hour on I know it's staring me in the face but I can't for the life of me see the error.
Here's what I have in Excel
=IF(($AA$4-Y5)>0,IF(T5="","yes","no"),"n/a")
Added fields in Alteryx
=IF(($datetimenow-Need date)>0,IF(Confdate="","yes","no"),"n/a")
My Alteryx formula.
IF DateTimeDiff(DateTimeNow(),[Need Date2],"days") >0 AND
IF IsNull([Confirm-Date]) AND DateTimeDiff(DateTimeNow(),[Need Date2],"days") >0 THEN 'YES'
ELSEIF IsNull([Confirm-Date]) AND DateTimeDiff(DateTimeNow(),[Need Date2],"days") <0 THEN 'NO'
I'm receiving Malformed IF Statement.
If you could help would be greatly appreciated.
ELSE 'N/A'
ENDIF
Sometimes adding indentation, for me, helps me to see it better:
IF DateTimeDiff(DateTimeNow(),[Need Date2],"days") > 0 AND IF IsNull([Confirm-Date]) AND DateTimeDiff(DateTimeNow(),[Need Date2],"days") > 0 THEN 'YES' ELSEIF IsNull([Confirm-Date]) AND DateTimeDiff(DateTimeNow(),[Need Date2],"days") < 0 THEN 'NO'
It goes from "AND" (end first line) to another IF (start enext line)... for an embedded IF, you won't need the "AND"... also, since you already enforce DateDiff > 2 on the "outter" IF, you needn't re-apply it as a condition on the inner IF... so, all, in all, does this work:
IF DateTimeDiff(DateTimeNow(),[Need Date2],"days") > 0 IF IsNull([Confirm-Date]) THEN 'YES' ELSE 'NO' ENDIF ENDIF
Something strange happened as it removed my last couple lines. Lets try again
IF DateTimeDiff(DateTimeNow(),[Need Date2],"days") >0 AND
IF IsNull([Confirm-Date]) AND DateTimeDiff(DateTimeNow(),[Need Date2],"days") >0 THEN 'YES'
ELSEIF IsNull([Confirm-Date]) AND DateTimeDiff(DateTimeNow(),[Need Date2],"days") <0 THEN 'NO'
ELSE 'N/A'
ENDIF
Ah, I see.... how about this then:
IF DateTimeDiff(DateTimeNow(),[Need Date2],"days") > 0 IF IsNull([Confirm-Date]) THEN
'YES' ELSEIF IsNull([Confirm-Date]) THEN
'NO'
ENDIF ELSE
'N/A' ENDIF
Still reporting Malforme IF at: the bold IF line 2
IF DateTimeDiff(DateTimeNow(),[Need Date2],"days") > 0
IF IsNull([Confirm-Date]) THEN
'YES'
ELSEIF IsNull([Confirm-Date]) THEN
'NO'
ENDIF
ELSE
'N/A'
ENDIF
Oops, typos, and missed the first "THEN" ...
IF DateTimeDiff(DateTimeNow(),[Need Date2],"days") > 0 THEN IF IsNull([Confirm-Date]) THEN 'YES' ELSE 'NO' ENDIF ELSE 'N/A' ENDIF