In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests after December 31, 2025. Set up your security questions now so you can recover your account anytime, just log out and back in to get started. Learn more 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