Free Trial

Alteryx Designer Desktop Discussions

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

DateTimeDiff, rounding help

wonka1234
10 - Fireball

Here is what I get in excel:

 

wonka1234_0-1657219244435.png

excel formula - =(V13-V11)/365.25

 

what im trying in alteryx:

DateTimeDiff([Maturity Date],[Run Date],"month")/12

 

wonka1234_1-1657219280444.png

 

but i am getting 7.0 . 

 

 

Is there a way to round this to get 6.50 like in excel?

 

 

 

 

 

 

 

17 REPLIES 17
gabrielvilella
14 - Magnetar

Hi @wonka1234, try this one:

DateTimeDiff([Maturity Date],[Run Date],'years')+(DateTimeDiff([Maturity Date],[Run Date],'months')-DateTimeDiff([Maturity Date],[Run Date],'years')*12)/12
chukleswk
11 - Bolide

Capture.PNG

You can also change your output type to a FixedDecimal of 10.2 and it will round it to the 2 decimal places.

wonka1234
10 - Fireball

@chukleswk 

 

still getting 7.0!

 

wonka1234_0-1657221546940.png

 

 

 

even with the formula

 

@gabrielvilella 

 

wonka1234_1-1657221596767.png

 

 

here are my inputs:

 

wonka1234_2-1657221685846.png

 

gabrielvilella
14 - Magnetar

I don't why I thought I had to do all that, but @chukleswk approach is much simpler, here is the example.

chukleswk
11 - Bolide

Do you have a sample file / flow that you can share? Are you changing 30-Sep-19 and 31-Mar-26 into a date that alteryx can handle (using the DateTime Parser or a formula)?

wonka1234
10 - Fireball

@gabrielvilella @chukleswk 

 

I convert the date from a string like this:

 

wonka1234_0-1657222012691.png

wonka1234_1-1657222026183.png

 

it comes in as a string because I use  dynamic rename.. I have to use it though otherwise it would be read in from the input as a date time .

 

chukleswk
11 - Bolide

that's because you are starting on 2019-01-30 and ending on 2026-01-31...that's 7 years.

 

Your start date needs to be 2019-09-30

chukleswk
11 - Bolide

Make sure you are converting the date using the following and please see the attached workflow.

 

Capture.PNG

gabrielvilella
14 - Magnetar

Another tip here is that you don't need multiple Date Time tools one after the other. I prefer using the Multi-field formula to do that in one single tool.

Labels
Top Solution Authors