Alteryx Designer Desktop Discussions

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

Calculating how many days to next Friday

Deano478
12 - Quasar

Hi all,

 

I have the dates below:

 

2023-01-13
2023-01-20
2023-01-27
2023-02-03
2023-02-03
2023-02-03
2023-02-10
2023-09-15
2023-02-03

What i'm trying to figure is how to calculate how many days it is until the next Friday from these dates it should be easy enough but i cant seem to get my head around it. 

 

Cheers for nay help in advance

4 REPLIES 4
lwolfie
10 - Fireball

I would use something like 5-DateTimeFormat([Date], "%w").  %w returns the day of the week as a number from 0-6, starting on Sunday.  Friday would be a 5 so it would be subtracting the day from 5.

Luke_C
17 - Castor

hi @Deano478 

 

Here's how I'd approach:

 

  • Add 7 to the date
  • Generate 1 row for every day between the two
  • Add formatting to show day of week (you can collapse this into the filter tool but wanted to show you for clarity)
  • Filter on Friday

image.png

binuacs
20 - Arcturus

@Deano478 

DateTimeAdd(DateTimeAdd([Date],5-ToNumber(DateTimeFormat([Date],"%w")),"days"),7,'days')

image.png

apathetichell
18 - Pollux

fyi - this technically this is "the next friday" - calculating days till "next friday" - ie the next occuring friday after "this friday" would require wrapping @binuacs 's nifty 5-xxxx statement in a mod(...,5) to correctly skip this friday.

Labels