Alteryx Designer Desktop Discussions

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

Filter data based on current week (weekdays)

pateldev22
7 - Meteor

I would like to filter out outside of the current week (weekdays).

 

Example, if i run the flow on the Thursday of this week, i would like to only keep results from Monday to Thursday. If Friday, then Monday to Friday. If Wednesday, then Monday to Wednesday. Exclude any Saturdays and Sundays, and prior weeks.

7 REPLIES 7
atcodedog05
22 - Nova
22 - Nova

Hi @pateldev22 

 

Here is how you can do it.

Workflow:

atcodedog05_0-1646235887483.png

 

Hope this helps : )

 

jrsheppard
7 - Meteor

@atcodedog05   This certainly works, however, for review purposes I tend to prefer a more documented approach.

 

I separate the formulas from the conditions being filtered using a formula tool to create weekdays / week no and a filter tool to filter on the conditions that should be met.  See the attached workflow.

 

pateldev22
7 - Meteor

thank you for the rec! wondering why 02/28 was excluded

pateldev22
7 - Meteor

also i need the original list of dates to be dynamic based on current week, not as a input data tool

Luke_C
17 - Castor

Hi @pateldev22 

 

@atcodedog05's solution is dynamic. The datetimetoday function returns the current date. The %u returns a numeric day of week (Monday is 1, Sunday is 7). 

pateldev22
7 - Meteor

have not had my morning coffee yet. clearly we need the input data tool as a population data set. LOL

atcodedog05
22 - Nova
22 - Nova

Happy to help : ) @pateldev22 

Cheers and have a nice day!

Labels