Alteryx Designer Desktop Discussions

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

Help in formula

Mohini79
7 - Meteor

Dear Team,

 

I am not able to do substration between two dates.. Getting error.

Please help. Work flow attached

8 REPLIES 8
DanielG
12 - Quasar

@Mohini79 Your workflow has input linked to a file on your desktop.  Can't test it with data.  However I do see that you have strings for dates, so basically your formula is trying to subtract a string from a string.  You need to convert the fields to dates (in YYYY-MM-DD format) and then do this formula DateTimeDiff(dt1,dt2,u) where "u" would be "days".

 

DateTimeDiff([Date Start],[Date End],"days")

 

 

 

 

alexnajm
17 - Castor
17 - Castor

Try DateTimeDiff([Start Date],[End Date],"days")

 

You can replace "days" with the unit that you are looking for!

Mohini79
7 - Meteor

Hi,

 

Getting attached error

DanielG
12 - Quasar

@Mohini79  - - see this sample.  I made up dates, as I dont know what yours look like but the DateTime Tools can figure out pretty much anything.  

nagakavyasri
12 - Quasar

Another way:

 

Screenshot 2023-06-14 140144.png

Mohini79
7 - Meteor

Dear Team,

 

Date excel attached.

Getting below error 

 

 

ConvError: Select (8): End Date: 07-jan-202 is not a valid Date

Rana_Kareem
9 - Comet

@Mohini79 

The date isn't in the standard format (YYYY-MM-DD), you should change it before doing the subtraction.

As you see in the syntax below .. First, changing the date format, then doing the operation.

 

Rana_Kareem_0-1686830841565.png

 

You can also change the unit in DateTimeDiff([End Date], [Start Date], "day") as you want, day or year.

 

I hope that helped you.

 

You can find here anything about Date Time Functions and how to use them

https://help.alteryx.com/20231/designer/datetime-functions

alexnajm
17 - Castor
17 - Castor

Thats correct - you need to convert your text values into date values to be able to do any date functions - please see attached.

Labels