Dynamic Date
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I have a source file that contains a column with various dates. I am needing to identify all data points that fall within the last 12 months, from a specific period. The specific period changes every month.
For example, for the month ending March 31,2020 I need to identify every data point that falls within the previous 12 months so anything from April 1, 2019 through March 31, 2020 would be identified.
I would want to make the current period date (03/31/2020) to be a dynamic input so the formula would continue to identify relevant dates every time the model is run in subsequent periods. Any and all help is appreciated
Solved! Go to Solution.
- Labels:
- Date Time
- Dynamic Processing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @Cbennett022,
you could use the following formula in a Filter Tool to achieve it:
[Date] >= ToDate(DateTimeAdd(DateTimeToday(), -1, "year"))
The "DateTimeToday()" will always get the date of the day the workflow is exectured. DateTimeAdd with -1 year will always get the Date from one year ago. Compare this to your "Date" Column and you should be good to go.
Let me know if this helps.
Best
Alex
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thank you for the quick response.
One thing to note. the initial date will always be the end of the given month. Is there a way to make the period selection dynamic, where it will update that formula based on the input of the date by the user?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Sure!
You can use a Date-Picker in combination with a Action Tool to use the Date the user wants.
One additional thought: You can also use the "DateTimeLastOfMonth" Function to get the last day of a give date.
Best
Alex
