Filtering data for the last 7 days excluding the weekends
Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
ManishaChand
5 - Atom
‎02-21-2024
05:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi I need to filter the dates for the last 7 days excluding the weekends.
Labels:
- Labels:
- Developer Tools
3 REPLIES 3
16 - Nebula
‎02-21-2024
05:47 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Check out the DateTime functions here: Functions (alteryx.com)
and the Filter tool
These resources may be helpful: above under Learn > Academy > Learning Paths and Interactive Lessons
Chris
cjaneczko
13 - Pulsar
‎02-21-2024
05:51 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
One way to do it would be to add a new field that converts the dates to days of the week, then filter out any of the Sat/Sun records. Use a sample tool and pull the last 7 records after that for the the most recent dates.
DateTimeFormat([DateTime_Out],"%a")
15 - Aurora
‎02-21-2024
05:53 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
it depends slightly what you mean. If you want to filter to the past 7 days, and also remove weekends then this filter will work:
datetimediff(datetimetoday(),[Date],'day')<=7
AND
LEFT(DateTimeFormat([Date],'%a'),1)!='S'
If you want to filter to the last 7 non-weekend days (so going back more than 7 days) then things are a bit more complicated...
