Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Subtracting Dates in Formula

Awickens
5 - Atom

Hi there,

 

New to using alteryx and I'm having some difficulty with the following formula and what date function to use:

 

(30/09/2019-1/10/2018)/365*0.1

 

It's currently not bringing up the days between those dates and these dates are a once off in a formula (not in the data input).

 

Many thanks for your help!

4 REPLIES 4
TonyA
Alteryx Alumni (Retired)

It looks like you are trying to calculate the number of days between two dates. Here's an example of a formula that does that in Alteryx:

 

DateTimeDiff("2019-09-30","2018-10-01","days")

 

With this function, you have a number of options for time periods, ("seconds", "minutes", "hours", etc.). Here's a link in Academy to some interactive training on date functions: https://community.alteryx.com/t5/Interactive-Lessons/DateTime-Functions/ta-p/98952. If you haven't done so already, I would recommend you go through as many of those introductory videos as you can. I found them very helpful when I started learning Designer.

 

 

RolandSchubert
16 - Nebula
16 - Nebula

Hi @Awickens ,

 

you have to convert the dates to dateformat in the first step, the you can use DateTimeDiff formula to calculate the difference in days and multiply that difference by 0.1. I've attached a sample workflow. Hope this is helpful.

 

Best regards

 

Roland

Awickens
5 - Atom

The date formula worked perfectly! Thanks @TonyA 

TonyA
Alteryx Alumni (Retired)

Glad that worked out for you @Awickens . Please mark any of the responses that answered your question as solutions so others with similar problems can find them. Thanks!

Labels