Important Community update: The process for changing your account details was updated on June 25th. Learn how this impacts your Community experience and the actions we suggest you take to secure your account here.

Alteryx Designer Desktop Discussions

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

DateTimeAdd Multiple Days

timioluwatimi
5 - Atom

[DateColumn2] = DateTimeAdd("2021-01-30", 10, "days")   will return   data from  10 days after 30th of January which is 9th February. How do I get data from the first 10 days  after "2021-01-30" instead?  i.e. every single day from 31st January till 9th February.  

11 REPLIES 11
Luke_C
17 - Castor

Hi @timioluwatimi 

 

The generate rows tool is your best bet:

Luke_C_0-1629128717271.png

 

atcodedog05
22 - Nova
22 - Nova

Hi @timioluwatimi 

 

Here is my take on it. If you are getting value from another column.

 

Workflow:

atcodedog05_0-1629129359785.png

 

Hope this helps : )

 

Maskell_Rascal
13 - Pulsar

Hi @timioluwatimi,

 

If I'm understanding your question correctly, you are looking to just filter your data between a set of dates. If this is correct, you can write the formula into your Filter tool as follows:

[DateColumn2] > "2021-01-30" AND [DateColumn2] <= DateTimeAdd("2021-01-30", 10, "days")

 

This will now filter to all dates from 2021-01-31 to 2021-02-09. There are ways to make this more dynamic instead of hardcoding it into the formula, but this should get you started. 

 

Cheers!

Phil

HomesickSurfer
12 - Quasar

Hi @timioluwatimi 

 

Filter your data accordingly with the following expression:

 

[Date] >= [Date] AND [Date] <= DateTimeAdd("2021-01-30", 10, "days")

 

Maskell_Rascal
13 - Pulsar

@HomesickSurfer - Tried your solution, not working as expected. [Date] >= [Date] is referencing itself, so will always be true. Your formula essentially boils down to [Date]<= "2021-02-09". So basically all dates before Feb 09 will be included. 

timioluwatimi
5 - Atom

Should clarify there are two different date columns so what worked was:  [Date2] >= [Date] AND [Date2] <= DateTimeAdd([Date], 10, "days")

HomesickSurfer
12 - Quasar

My formula references a range.  It works, assuming that the data has 1 date field to analyze.

atcodedog05
22 - Nova
22 - Nova

Interesting scenario on how usecase can be misinterpreted in different ways 😅

 

Kudos to you @Maskell_Rascal and @HomesickSurfer for interpreting it correctly 🙂👍

Gaurav_1604
5 - Atom

Hi All, I want to replace '30' in below function with column reference. I need 2nd argument in datetimeadd to be dynamic for which the number of days feed comes from another column (in my case another column is 'No. of Days'). please suggest how is it possible?

 

datetimeadd([Date],30,'days')

Labels