Alteryx Designer Desktop Discussions

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

Calculating Aging (only business days)

AbhijeetChib
8 - Asteroid

Good Day Everyone !!

 

I have a field called Ageing. It is calculated as Current Date - Rec Date. 

So if my Rec date is = 2023-04-15 and Current Date = 2023-04-25 then the Ageing = 10 days. 

 

How do i calculate Ageing (Business days) - Which is ageing minus the weekends. 

In the above example ageing business = 7 days. 

 

Thanks for suggestions 

4 REPLIES 4
PhilipMannering
16 - Nebula
16 - Nebula

Not very efficient, but you could generate dates between start and end and filter out those where the day is a Saturday or Sunday. See example attached,

PhilipMannering_0-1682426923638.png

 

ArnaldoSandoval
12 - Quasar

Hi @AbhijeetChib 

 

The number of Business Days between two days, ignoring holidays is calculated by the formula below:

 

5 * [ Full Weeks ]  + 5 ( [Last Week Fraction] - [ Full Weeks ] )

 

Where:

Full Weeks = Floor( [ Days between dates ] / 7 )

Last Week Fraction = [ Days between dates ] / 7

 

Notes:

  • Last Week Fraction is a floating number.
  • We multiply by 5 because for Business Days, the week is 5 days.

 

This article explains the maths How many weeks between two dates 

 

hth

Arnaldo

 

Yoshiro_Fujimori
15 - Aurora

Hi @AbhijeetChib ,

 

Formula tool only.

Not fully tested, but it seems to work in most cases 😋

 

Formula

DoW_RecDate       = ToNumber(DateTimeFormat([Rec date],"%u"))

BusDays_FirstWeek = IF [DoW_RecDate] > 5 THEN 0 ELSE 6 - [DoW_RecDate] ENDIF

DoW_CurDate       = ToNumber(DateTimeFormat([Current Date],"%u"))

BusDays_LastWeek  = IF [DoW_CurDate] > 5 THEN 5 ELSE [DoW_CurDate] ENDIF

Weeks             = ToNumber(DateTimeFormat([Current Date],"%W")) - ToNumber(DateTimeFormat([Rec date],"%W")) - 1

Aging_Bus         = [Weeks] * 5 + [BusDays_FirstWeek] + [BusDays_LastWeek]

 

Output

Yoshiro_Fujimori_0-1682430450057.png

 

Christina_H
14 - Magnetar
Labels