Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Only at Qlik Connect! Guest keynote Jesse Cole shares his secrets for daring to be different. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
rathorep
Contributor III
Contributor III

Urgent question:How to count number of days between 2 dates excluding weekend

I am creating a dimension field in qlik app sheet and on that i want to take number of days between 2 dates minus Saturday and Sunday. It means i want only count of working days excluding weekend.

Please help to know how i can achieve it as i am new to qlik.

Thanks in advance

2 Solutions

Accepted Solutions
Vegar
MVP
MVP

Use NetWorkdays (BeginningDate, EndDate) or if you have custom holidays then use NetWorkDays(BeginningDate, EndDate, <list of holidays> ) 

View solution in original post

4 Replies
Vegar
MVP
MVP

Use NetWorkdays (BeginningDate, EndDate) or if you have custom holidays then use NetWorkDays(BeginningDate, EndDate, <list of holidays> ) 

MindaugasBacius
Partner - Specialist III
Partner - Specialist III

rathorep
Contributor III
Contributor III
Author

Thanks for your prompt answer but the prob is, when i am calculating difference between 2 days excluding weekend using network days then, for example-

resolve_Date:11/7/2019 11:12:30 AM and 

open_date : 11/5/2019 3:13:56 PM

date(NetWorkDays(date(Open_Date,'MM/DD/YYYY'),date(Resolve_Date,'MM/DD/YYY'))

-Result is coming -3 days (not considering exact hours)

but when i am using 

date((date(Resolve_Date,'MM/DD/YYY')-date(Open_Date,'MM/DD/YYYY'))

result :1.832338( which is exact calculation of hours but inclusing weekend)

 

so basically i want to exclude sat and sun between open_date and resolve_Date, but i want to calculate exact hours.

Please help...

 

Vegar
MVP
MVP

NetWorkDays will always be larger than endate-startdate as it is including both start and end in the count. If you don't want this behaviour you will need to adjust your interval by 1 in the start or end date. 

If you only have resolve and open dates during mon-fri then you could substract the number of weekend days from your expression.  

[Total time interval]-[No of Weekend days]

No of weekend days you can calculate like this:

FLOOR(ResolveDate) +1- FLOOR(OpenDate) - NetWorkDays(OpenDate,ResolveDate )