Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
wanyunyang
Creator III
Creator III

Count intervals between two dates regardless of weekends

Hi guys,

 

My data has two columns: StartDate and EndDate, from the script, I would like to count intervals between these two dates, regardless of weekends.

 

For example, if StartDate is 05/13/2019 (Mon), EndDate is 05/14/2019 (Tue), Interval will be 1 day; 

If StartDate is 05/10/2019 (Fri), EndDate is 05/14/2019 (Tue), Interval will be 2 rather than 4 days.

 

How should I write the expression? Thanks in advance!

1 Solution

Accepted Solutions
Vegar
MVP
MVP

Check out the NetWorkDays function.

NetWorkDays (StartDate, EndDate) as NetWorkDays

https://help.qlik.com/en-US/sense/February2019/Subsystems/Hub/Content/Sense_Hub/Scripting/DateAndTim...

Ps: NetWorkDays counts both start and end as dates so you do need to adjust your interval if you don't want both days included into your count. 

View solution in original post

1 Reply
Vegar
MVP
MVP

Check out the NetWorkDays function.

NetWorkDays (StartDate, EndDate) as NetWorkDays

https://help.qlik.com/en-US/sense/February2019/Subsystems/Hub/Content/Sense_Hub/Scripting/DateAndTim...

Ps: NetWorkDays counts both start and end as dates so you do need to adjust your interval if you don't want both days included into your count.