Alteryx Designer Desktop Discussions

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

subtract two dates and divide by 365.25

wonka1234
10 - Fireball

Hi,

 

I am trying to do this formula:

Date 1 - Date 2 / 365.25 OR

maturity date - run date / 365.25  OR 

31-Mar-26  -   30-Sep-19  / 365.25

 

I am expected 6.50 as the answer.

 

However I am getting 6 when I do this:

 

DateTimeDiff([ Maturity Date ],[ Run Date ],"years")

 

2 REPLIES 2
apathetichell
18 - Pollux

you want to change that from "years" to "days" (or hours) and then do the division... DateTimeDiff gives an integer as an output.

OllieClarke
15 - Aurora
15 - Aurora

@wonka1234 DateTimeDiff() will always return an integer value. Which is calculated as the number of complete periods between the dates. So if you want decimal values, then you need a smaller datepart - e.g. months. You can then divide this number by e.g. 12

OllieClarke_1-1654870076125.png

 

 

Labels