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

Add a date from a Year value

Acoury
5 - Atom

Hello, this is a simple exercise in Excel, but I can't get it to work in Alteryx. Here is what I would like to do:

 

1) Take a Model Year field and subtract by 1 (MY= 2016 becomes 2015)

2) Take the MY-1 and set that to the Year and add August 1 as the Month Day (Output is = 8/1/ [MY-1])

3) Subtract a date in another field from the output (8/1/2019- Output(8/1/2015)= 365)/365= 1

 

So the output gives the difference between the values as Age in years to 2 decimal places

 

The equivalent in Excel is like this:

 

=ROUND((Date 1-("8/1/"&Model Year-1))/365,2)

 

Thanks!

2 REPLIES 2
patrick_digan
17 - Castor
17 - Castor

I think this formula will replicate your excel formula:

Round(DateTimeDiff([Date 1],tostring([Model Year] -1)+"-08-01","days")/365,.01)

 

Acoury
5 - Atom

That seems to have done the trick! 

 

Thanks!

Labels
Top Solution Authors