Alteryx Designer Desktop Discussions

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

Subtract two dates based on criteria in a specified field

ZoeM
8 - Asteroid

Community,

Happy Tuesday.

I want to subtract two dates based on the results of a third field.

If the status is closed, then subtract Start Date from End Date.

All other statuses, subtract Start Date from Today().

 

Please see sample data. 

 

Thanks!

 

 

 

3 REPLIES 3
BrandonB
Alteryx
Alteryx

IF [status] = "closed"

THEN datetimediff([End Date], [Start Date], "days")

ELSE datetimediff(DateTimeNow(), [Start Date], "days")

ENDIF

rfoster7
9 - Comet

if [status] = "Closed"
then datetimediff([end],[start],'days')
else datetimediff(DateTimeToday(),[start],'days')
endif

BrandonB
Alteryx
Alteryx

Example attached

 

Calculation.png

Labels