Alteryx Designer Desktop Discussions

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

Expression for specific date range and get information from yesterday + weekends

Charcho
7 - Meteor

Hello,

I use the next expression to get information from yesterday in consideration of weekends (if it is Monday, keep Saturday and Sunday, if not, only the current day). But I would like to add a more expression to get data in an specific date range (from yesterday 1 a.m. till today 1.a.m). How can I do that? I am not clear about it...

 

The expression:

 

IF Datetimeformat(DateTimeToday(),"%a")="Mon"
// check if we are on Monday
THEN (DateTimeDiff(DateTimeToday(),Datetimetrim([Date_Process_2],"days"),"days")>=1
AND DateTimeDiff(DateTimeToday(),Datetimetrim([Date_Process_2],"days"),"days")<=3)
//keep Sat and Sunday
ELSE DateTimeDiff(DateTimeToday(),Datetimetrim([Date_Process_2],"days"),"days")=1
// keep the day as today (different from Monday)
ENDIF

 

 

3 REPLIES 3
AndrewDMerrill
13 - Pulsar

Not sure if this is exactly what you are looking for, but I believe it accomplishes what you requested (modifying should be quite easy to fit your needs)

2023-11-16_13-10_Date Filtering2.png

2023-11-16_13-10_Date Filtering.png

Charcho
7 - Meteor

Thank you! I have to tested one Monday but it runs perfect

AndrewDMerrill
13 - Pulsar

If this thread is solved, please mark as solution so others may also find answers more easily!

Labels