Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Community is experiencing an influx of spam. As we work toward a solution, please use the 'Notify Moderator' option on the ellipsis menu to flag inappropriate posts.
Free Trial

Alteryx Designer Desktop Discussions

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

Date Time today

Plewis1
8 - Asteroid

Good afternoon Alteryx team,

I have built a flow that runs weekly. When it runs once a week I want the flow to run today's date and -7 days back so it picks up the week pryor. But when the flow runs it is only picking up the 7th day back. Example- today is 10/10, when the flow runs it only picks up 7/3. Here is what my formula says DATETIMEADD(DateTimeToday(), -7, "days")

Any help is appreciated. Thank you

6 REPLIES 6
Thableaus
17 - Castor
17 - Castor

Hi @Plewis1 

 

Could you please show a sample of what you're trying to do?

 

A sample of your workflow, and explain better what you're trying to achieve.

 

Cheers,

lmorrell
11 - Bolide

Hi @Plewis1 

 

Dates can be tricky at the best of times, so a good starting point is to first confirm that all your relevant Date columns are in the DateTime format. This will eliminate any downstream errors when comparing one date against another. 

 

Regarding your formula, your logic is spot on in regards to removing the 7 days, but the key will be to compare this formula against the date field formatted as a DateTime column within the dataset - for example "Date". By using the below formula in a Filter Tool, you should be able to obtain records only within the last 7 days. 

 

[Date] >=  DATETIMEADD(DateTimeToday(), -7, "days")

//Where [Date] is a substitute for the Date column within the dataset

 

Hope this helps!

Plewis1
8 - Asteroid

Here is the formula that is built. As you can see the date is showing 10/3 when it should be the whole week. 10/3 to 10/10. I highlighted it in yellow. 

clipboard_image_1.png

Hee is my spreadsheet from the output tool. All the dates in my date column are all 10/3. 

clipboard_image_2.png

lmorrell
11 - Bolide

Hi @Plewis1 

 

Workflow is attached. 

 

Snag_71ba0777.png

 

 

Thanks for providing these examples. One potential issue could be that your formula is overwriting every cell in the column "INSPECTION_CREAT..." with the date from 7 days ago.

 

But I can see that your date column is indeed formatted as a date column, so by using the Filter Tool we can get records for the week prior anchored to anchored to today's date.

 

Assuming that the column "INSPECTION_CREAT..." is "INSPECTION_CREATED_DATE" and has not been overwritten by the formula tool in example, then the below workflow returns only records that are within the past 7 days. 

 

Hope this helps!

Plewis1
8 - Asteroid

Thank you for that flow. Flow still shows to have one issue. I am only seeing data out of the FALSE connection and not the TRUE. The data coming out of the FALSE connection has all the days going back to 2018. And there is no data coming out of the TRUE connector.  I will put an example below. 

FALSE CONNECTOR 

clipboard_image_0.png

TRUE CONNECTOR

clipboard_image_1.png

Plewis1
8 - Asteroid

Nvm, There isn't any dates in my sheet from today and -7. Thank you for your help. 

Labels
Top Solution Authors