Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculate time difference only weekdays

Hello,

I have a field called "Opened_at" and a field "resolved_at".  I need to calculate the duration but only M-F, excluding weekends.

Any ideas?

Thanks - Jason

3 Replies
effinty2112
Master
Master

Try something like

if(inweek ( Opened_at, resolved_at, 0 ),

resolved_at - Opened_at, // if in same week this will be difference in seconds

resolved_at - Opened_at - (week(resolved_at)- week(Opened_at)) * 2*24*60*60 // if not in same week this will be difference in seconds minus the number of seconds in intervening weekends

))

Not applicable
Author

I think I might have gotten it, seems there is a "NetworkDays" function in Qlik.

So NetworkDays(startdate, enddate) returns WeekDay duration.

tamilarasu
Champion
Champion

Yes, Networkdays (Startdate, Enddate,

Holidays). Third parameter is holiday.

You can define the holiday list in a variable so

you can change the values for future.