Free Trial

Alteryx Designer Desktop Discussions

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

Filter By the Following Week - Monday through Sunday

KmbrlyPC
8 - Asteroid

I have a date column and I am wanting to filter it by Monday through Sunday of the following week regardless of when I run the workflow. So if I run my workflow today for example (3/9/21), I want to see data for the week of 3/15/21 through 3/21/21. If I run the workflow on Tuesday (3/16/21), I want to see data for the week of 3/22/21 through 3/28/21. So regardless of when it's run, I am always wanting the following week Monday through Sunday.

4 REPLIES 4
Maskell_Rascal
13 - Pulsar

Hi @KmbrlyPC 

 

The attached workflow should work for you. I'm using some formulas to always give me the dates for next week, and then using the filter after that. The formula uses DateTimeNow(), so it will always update the dates based on the day you run it. 

 

Maskell_Rascal_0-1615322938126.png

 

If this solves your issue please mark the answer as correct, if not let me know!

 

Thanks!

Phil

AngelosPachis
16 - Nebula

Hi @KmbrlyPC 

 

I have mocked up some data and created a workflow that hopefully answer your question. Assuming that as an input we have a list of dates and then the timestamp of when the workflow runs

 

AngelosPachis_0-1615323692499.png

 

In the formula tool that follows, you need 4 expressions. One to give you the weekday of today's date (or when the workflow runs), another to estimate how many days away you are from next Monday and then you only need to estimate that date for next Monday and the End Date of that week.

 

AngelosPachis_1-1615323786107.png

 

Then with the filter tool, you can keep only the dates that fall within next week. 

 

Two notes:

 

1) I opted for a text input tool because that allows you to go on and change that input of when your workflow was run and see how the output changes. So if you go on and change it from "2021-03-09" to "2021-04-05", notice how you will get a different list of dates. That acts as a proof of concept of how the workflow will behave once you implement it in your workflow.

 

2) Once you implement it to your workflow, make sure to change all references to the field [Date you Run workflow on] in the formula and filter tool to Datetimetoday(). That will convert your workflow from static to dynamic.

 

Hope that helps, let me know if you have any questions.

 

Cheers,

 

Angelos

 

 

 

 

KmbrlyPC
8 - Asteroid

It looks like it's working nicely, thank you. I like your simple method.

Steph
6 - Meteoroid

Was able to use this as well, thank you! 😊

Labels
Top Solution Authors