Alteryx Designer Desktop Discussions

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

Filter data by last week

Dan5
8 - Asteroid

How can i create a filter that grabs records from last week? Like starting sunday and ending sunday, not past 7 days. 

11 REPLIES 11
RobertOdera
13 - Pulsar

Sure thing, @Dan5 

 

There are several approaches (best if we had a sample file/ mock-up).

 

Please like + mark as an acceptable solution if this works for you.

 

If your data set is huge, use the Sort Tool + Sample Tool approach (or we could use the Generate Rows Tool to generate join Dates to return only the range that you need).

I've intentionally avoided using Today() or DateTimeNow() treatments if you have a data set that terminates in the past.

The approach below is dynamic, so no need to manually update for periodicities.

 

Please see the attached workflow. Cheers!

 

RobertOdera_0-1603412979511.png

 

MNewt9
7 - Meteor

Is this possible to pull within the initial SQL query and not just from a static data set like an Excel sheet, database, etc.?

 

I'm trying to generate a scheduled run in the server for each Monday to pull the prior Sun-Saturday.  However, in the event we get a request to do an adhoc refresh on say a Wednesday it still pulls the last full week.

Labels