Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
francesctesi
Contributor III
Contributor III

Calculate working Hours between two dates

Hi,

I would like to calculate the number of working days between two dates, divided by month.

In particular, I've two variables (format MMM-YYYY):

-let vStartDate= (peek('datamin',0));  (Jan-2020)
 - let vEndDate = (peek('datamax',0)); (Dic - 2023)

I would like to have a table, where for each month I have the number of working days,like this:

francesctesi_0-1696514654281.png

thanks so much!!

 

 

Labels (3)
1 Reply
maxgro
MVP
MVP

maybe with NetWorkDays

https://help.qlik.com/en-US/qlikview/May2023/Subsystems/Client/Content/QV_QlikView/Scripting/DateAnd...

 

DT:
LOAD
addmonths(makedate(2020), iterno()-1) as Start,
Date(Floor(MonthEnd(addmonths(makedate(2020), iterno()-1)))) as End
AutoGenerate 1
While addmonths(makedate(2020), iterno()-1) <= makedate(2023,12);
 
LEFT JOIN (DT)
load
Start,
NetWorkDays(Start, End) as WorkingDays
Resident DT;