Alteryx Designer Desktop Discussions

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

Adding a Column where the Value is a Date Range

MarcusHankinsOptum
6 - Meteoroid

I am Working on a Work Flow where I need to add a column that shows a Date Range. (IE 03/07/2019-03/14/2019).

This will be an automated Work Flow that will go out each Monday and the Date Range of the column would need to be for the previous week. Example ( if the workflow runs on 03/11/2019, the column would need to have value 03/04/2019-03/10/2019) Since this will be an automated the Date Range Value would need to be able to update each week.

 

If anyone can help that would be amazing

3 REPLIES 3
JoBen
11 - Bolide

Hi @MarcusHankinsOptum, here is a formula that should do that for you. 

 

DateTimeFormat(DateTimeAdd(DateTimeAdd(DateTimeToday(),-7,'days'),-ToNumber(DateTimeFormat(DateTimeAdd(DateTimeToday(),-7,'days'),'%w'))+1,'days'),"%m/%d/%Y")+"-"+DateTimeFormat(DateTimeAdd(DateTimeAdd(DateTimeToday(),-7,'days'),-ToNumber(DateTimeFormat(DateTimeAdd(DateTimeToday(),-7,'days'),'%w'))+7,'days'),"%m/%d/%Y")

 

Help1.PNG

JoBen
11 - Bolide

Hey @MarcusHankinsOptum, after reading your post closer, did you want the previous range relative to whatever date it was run? So, for instance if the workflow ran today the range would be 02/27/2019-03/06/2019? If so, this formula should do it. 

 

DateTimeFormat(DateTimeAdd(DateTimeToday(),-8,'days'),"%m/%d/%Y")+"-"+DateTimeFormat(DateTimeAdd(DateTimeToday(),-1,'days'),"%m/%d/%Y")

MarcusHankinsOptum
6 - Meteoroid

Awesome that was exactly what I was looking for and it worked.

Labels