ALTERYX INSPIRE | Join us this May for for a multi-day virtual analytics + data science experience like no other! Register Now

Alteryx Analytics Hub

Find answers, ask questions, and share expertise about Alteryx Analytics Hub.

Date issue

5 - Atom

I am connecting to a data base and want the Data pull to always start on the previous Monday. The expression is called return_date and I cant get any criteria to work. Any suggestions? 

14 - Magnetar

Hi @BBaes 


In Microsoft SQL Server, you could use the following query to select all records from a table from the previous Monday onwards.


select *
from my_table
where my_date >= dateadd(week,datediff(week,0,getdate()),0);


The exact syntax will depend on the type of database you are using.


I've created an example in SQL Fiddle that you can use to explore the query or adapt it for a different flavour of SQL.!18/39c01/6