Hi,
I'm new to Alteryx and am trying to convert a formula I have working in Excel for use in Alteryx:
IF([Start Date]> DateTimeToday(),
[Finish Date]-[Start Date],
IF([Finish Date]-DateTimeToday()<=0,7,[Finish Date]-DateTimeToday()))/7
But I'm getting an error of Error: Formula (21): Parse Error at char(32): Malformed If Statement (Expression #1)
My original code was:
=IF(Start Date>TODAY(),Finish Date-Start Date,IF(Finish Date-TODAY()<=0,7,Finish Date-TODAY()))/7
Any suggestions or solutions would be much appreciated.
Solved! Go to Solution.
Try this
IF [Start Date]> DateTimeToday()
THEN [Finish Date]-[Start Date]
ELSEIF [Finish Date]-DateTimeToday()<=0
THEN 7
ELSE [Finish Date]-DateTimeToday()/7
ENDIF
@Julie_Clarke Use DateTimeDiff function for taking the date difference
IIF([Start Date] > DateTimeToday(),DateTimeDiff([Finish Date],[Start Date],'day'),
IIF(DateTimeDiff([Finish Date],DateTimeToday(),'day')<=0,7,DateTimeDiff([Finish Date],DateTimeToday(),'day')))/7
Of course - thank you.
Hi
Thanks for this, but this generates an error
Error: Formula (21): Parse Error at char(147): Formula: tried to apply numeric operator to string value (Expression #1) ??
My dates are in date format.
@Julie_Clarke It is difficult to say what might be the issue without seeing your input data. I am attaching a sample workflow that uses the same formula on two date fields. Can you compare with your workflow?
Hi,
I did that initially and it didn't seem to work, hence my email but have now tried again with success - thank you for confirming the approach.
User | Count |
---|---|
17 | |
15 | |
15 | |
8 | |
6 |