Alteryx Designer Desktop Discussions

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

Group Dates to Weeks Starting Thursday

Phyllis
7 - Meteor

I currently have the left column, but would like to output the right. Week starts on Thursday and the listed "week" date should be the first day of the week.

 

DateWeek
12/15/201612/15/2016
12/16/201612/15/2016
12/17/201612/15/2016
12/18/201612/15/2016
12/19/201612/15/2016
12/20/201612/15/2016
12/21/201612/15/2016
12/22/201612/22/2016
12/23/201612/22/2016
12/24/201612/22/2016
12/25/201612/22/2016
12/26/201612/22/2016
12/27/201612/22/2016
12/28/201612/22/2016
12/29/201612/29/2016
12/30/201612/29/2016
12/31/201612/29/2016
1/1/201712/29/2016
1/2/201712/29/2016
1/3/201712/29/2016
1/4/201712/29/2016

 

Thanks!

4 REPLIES 4
Philip
12 - Quasar

This formula will calculate the week start date, assuming [Date] is a date type. The idea is to find the number of days offset from Thursday and subtract them from Thursday's date to get Thursday's date as the week start date.

 

DateTimeAdd([Date],
Switch(DateTimeFormat([Date], "%a"), 0,
"Fri", -1,
"Sat", -2,
"Sun", -3,
"Mon", -4,
"Tue", -5,
"Wed", -6
)
, 'day')

 

gc
9 - Comet

This solution is more generic, I think, where you can specify your 7 day groups of dates based on the assumption that your original column of dates is A) sorted min to max and B) starts on the date you want to begin your 7 day grouping.

Phyllis
7 - Meteor

Thank you! I feel silly not thinking of this!

moinshaik
7 - Meteor

Is there a solution for the above case. I am not able to locate what exactly we need to do. I have a daily data and I need it weekly for example below. Sunday being the weekend day.

 

10/1/201910/6/2019
10/2/201910/6/2019
10/3/201910/6/2019
10/4/201910/6/2019
10/5/201910/6/2019
10/6/201910/6/2019
10/7/201910/13/2019
10/8/201910/13/2019
10/9/201910/13/2019
Labels