Calling all Alteryx customers: Refer your colleague to try Alteryx and receive a $50 gift card. Sign up now!

Alteryx Designer Desktop Discussions

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

Day count - Date calculation

Sarath27
8 - Asteroid

Hi All,

 

Please help me with this very tricky formula to find day count with respect to following condition.

 

Mon  - 1

Tue   - 1

Wed  - 1

Thu   - 1

Fri     - 3

 

except for the below condition.,

 

  1. If a month is starting on Saturday or Sunday, then immediate Monday should be a correct business date. If a month is starting with Saturday, then immediate Monday should have 3 day counts and if a month is starting with Sunday, then immediate Monday should have 2-day counts. 
  2. If a month-end day is Friday, subsequent Saturday and Friday should flow in next month and number of day counts should be 1 for that Friday.
DateDayDay countExplanation
2024-08-01Thursday1Usually Monday to Thursday have day count as 1 and Friday have 3
2024-08-02Friday3
2024-08-05Monday1
2024-08-06Tuesday1
2024-08-07Wednesday1
2024-08-08Thursday1
2024-08-09Friday3
2024-08-12Monday1
2024-08-13Tuesday1
2024-08-14Wednesday1
2024-08-15Thursday1
2024-08-16Friday3
2024-08-19Monday1
2024-08-20Tuesday1
2024-08-21Wednesday1
2024-08-22Thursday1
2024-08-23Friday3
2024-08-26Monday1
2024-08-27Tuesday1
2024-08-28Wednesday1
2024-08-29Thursday1
2024-08-30Friday2If a month end falls on Friday and the subsequent Saturday falls on the same month, then Friday has day count as 2
2024-08-31Saturday  
2024-09-01Sunday  
2024-09-02Monday2Since Month is starting on Sunday, then Monday has day count as 2
2024-09-03Tuesday1 

 

 

 

4 REPLIES 4
OTrieger
13 - Pulsar

@Sarath27 
Create a yearly calendar in Alteryx use formula tool to get days and then with some formula logic you can get your logics. You can do it by setting in your first cell 2024-01-01 and then generate 365 rows or 366 rows in a leap year and with a simple formula generate the rest of the dates. From these dates generate in a different field the week days and then you have all the data to get your logic set

Sarath27
5 - Atom

I am really sorry if I put it in a correct way to address the issue 

 

All I want is to assign the day count based on given condition.

 

Mon - Thursday - Day count should be 1

 

Friday should be 3.

 

But the above day count assigning is exempted from the below 2 conditions.

 

  1. If a month is starting with Saturday, then immediate Monday should have 3 day counts and
  2. If a month is starting with Sunday, then immediate Monday should have 2-day counts. 
  3. If a month-end day is Friday, subsequent Saturday and Friday should flow in next month and number of day counts should be 1 for that Friday and for the Monday it should be 3.

Please help constructing a formula for the dates of AUG.

Qiu
21 - Polaris
21 - Polaris

@Sarath27 
I think we can locate the beginning and Ending of the month with Number, then check as below.

0913-Sarath27.png

Sarath27
8 - Asteroid

It works perfectly, thank you so much for this!

Labels
Top Solution Authors