We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Dynamic Date Time

akvsachin
8 - Asteroid

If someone can please help me with Dynamic Date configuration.

like when I run the workflow I need it to automatically run for T-2 days.

 

unfortunately I can't provide the workflow I'm currently working on.

5 REPLIES 5
binuacs
21 - Polaris

@akvsachin  if T is the current date then you can use the formula DateTimeAdd(DateTimeToday(),-2,'day')

GrowthNatives
8 - Asteroid

Hey akvsachin,
I see you're running into an issue with Dynamic Date Time. Here are a few solutions you can try:

1. Use a Formula Tool to create the T-2 date
- Add a Formula Tool early in your workflow (right after the Input tool or wherever you're configuring filters).
- In the Formula Tool, create a new field or update your existing date field with this expression. This will return the date value for T-2

DateTimeAdd(DateTimeToday(), -2, "days")


2. If you're filtering your data for this specific date, add a Filter Tool :
- In the Filter Tool’s expression, you might write something like:

[YourDateField] = DateTimeAdd(DateTimeToday(), -2, "days")

(Replace `[YourDateField]` with the actual name of your date column)

 


If you're comparing only the date (not time), use this:

DateTimeFormat([YourDateField], "%Y-%m-%d") = DateTimeFormat(DateTimeAdd(DateTimeToday(), -2, "days"), "%Y-%m-%d")

 
Hope this solution helps you make the most of Alteryx! If it did, click 'Mark as Solution' to help others find the right answers.

💡Found it helpful? Show some love with kudos  as your support keeps our community thriving!

🚀Let’s keep building smarter, data-driven solutions together! 🚀

akvsachin
8 - Asteroid

@binuacs 

@GrowthNatives 

How can I create it when requirement goes like 

if the workflow runs on Monday, it runs for dates 'Thursday and Friday'

similarly if it runs on Sunday, the dates would be of 'Thursday and Friday' 

and so on.
As in, the dates are going to of 5 days of the week. and T-2 goes around these 5 days only.

GrowthNatives
8 - Asteroid

Hey akvsachin,

So we are working with a custom T-2 logic that behaves differently based on the day of the week — especially skipping weekends

Requirement Summary:

Monday -> Thursday & Friday
Sunday -> Thursday & Friday
Saturday -> Thursday & Friday
Friday -> Wednesday & Thursday
Thursday -> Tuesday & Wednesday
Wednesday -> Monday & Tuesday
Tuesday -> Friday (previous week) & Monday

Steps in Alteryx:

  1. Add a Formula Tool

  2. Create two new fields:

    • TargetDate1

    • TargetDate2

  3. Use this logic (for example, in TargetDate1):

IF DateTimeFormat(DateTimeToday(), "%A") IN ("Monday", "Sunday", "Saturday") THEN
    DateTimeAdd(DateTimeToday(), -3, "days") 
ELSEIF DateTimeFormat(DateTimeToday(), "%A") = "Friday" THEN DateTimeAdd(DateTimeToday(), -2, "days")
ELSEIF DateTimeFormat(DateTimeToday(), "%A") = "Thursday" THEN DateTimeAdd(DateTimeToday(), -2, "days")
ELSEIF DateTimeFormat(DateTimeToday(), "%A") = "Wednesday" THEN DateTimeAdd(DateTimeToday(), -2, "days")
ELSE DateTimeAdd(DateTimeToday(), -4, "days")
ENDIF

Now for TargetDate2:

IF DateTimeFormat(DateTimeToday(), "%A") IN ("Monday", "Sunday", "Saturday") THEN
    DateTimeAdd(DateTimeToday(), -2, "days") 
ELSEIF DateTimeFormat(DateTimeToday(), "%A") = "Friday" THEN DateTimeAdd(DateTimeToday(), -1, "days")
ELSEIF DateTimeFormat(DateTimeToday(), "%A") = "Thursday" THEN DateTimeAdd(DateTimeToday(), -1, "days")
ELSEIF DateTimeFormat(DateTimeToday(), "%A") = "Wednesday" THEN DateTimeAdd(DateTimeToday(), -1, "days")
ELSE DateTimeAdd(DateTimeToday(), -1, "days") ENDIF


4.After creating these two target dates, add a Filter Tool like this:

DateTimeFormat([YourDateField], "%Y-%m-%d") = DateTimeFormat([TargetDate1], "%Y-%m-%d") OR
DateTimeFormat([YourDateField], "%Y-%m-%d") = DateTimeFormat([TargetDate2], "%Y-%m-%d")



Hope this solution helps you make the most of Alteryx! If it did, click '
Mark as Solution' to help others find the right answers.

Found it helpful? Show some love with kudos 👍 as your support keeps our community thriving!

🚀Let’s keep building smarter, data-driven solutions together! 🚀

stevemarkovick
7 - Meteor

I was finally able to get my workflow running dynamically for T-2! The additional logic shared for handling weekday variations (like running Thursday/Friday dates on Monday or Sunday) was a lifesaver. I really appreciate how this community dives into nuanced use cases—it’s exactly what makes the Alteryx forums so valuable. Looking forward to sharing my experience and helping out here more often.

Labels
Top Solution Authors