Let’s talk Alteryx Copilot. Join the live AMA event to connect with the Alteryx team, ask questions, and hear how others are exploring what Copilot can do. Have Copilot questions? Ask here!
Start Free Trial

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
11 - Bolide

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

BrandonB
Alteryx
Alteryx

Example attached

 

Calculation.png

Labels
Top Solution Authors