Alteryx Designer Desktop Discussions

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

Date Convert to Week Ended

CPAul
7 - Meteor

I'm new to Alteryx, hopefully this is an easy question... I'm trying to identify the week ending date based on a date that I have. For example, today's date 07/09/2019 would be the Friday week ended 07/12/2019. Thanks!!

4 REPLIES 4
neilgallen
12 - Quasar

 A pretty brute force method would be to figure out the day of the week (Monday = 2, for example) and then calculate the difference between the given date and Friday (4 days, using our example). Then add that number of days to the original date using a datetimeadd formula.

 

This would need to adjust for Saturdays however, as I'm guessing you'd want the following week, not the previous day.

LordNeilLord
15 - Aurora

Hey @CPAul 

 

I went for an approach that adds 7 days onto your date and then filters for the fridays...

 

Capture.PNG

CPAul
7 - Meteor

Clever! thank you!

Paul

CPAul
7 - Meteor

one very minor correction to the solution, the "Condition Expression" in the Generate Rows tool should be:

DateAdd <= DateTimeAdd(Date, 6, "Days")

 

instead of:

DateAdd <= DateTimeAdd(Date, 7, "Days")

 

The original way double counted days that were already a Friday.

 

Thanks again,

Paul

Polls
We’re dying to get your help in determining what the new profile picture frame should be this Halloween. Cast your vote and help us haunt the Community with the best spooky character.
Don’t ghost us—pick your favorite now!
Labels