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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Holidays in Working Hours Calc

Hi All,

I have successfully be able to calculate the working hours with holidays loaded from an excel spreadsheet as shown below. I have now created a table in a database with the holidays in instead as it will be easier to maintain. How do i change the script to pull the holidays from a database instead of the excel sheet.

 

tmpHoliday:

LOAD [PUBLIC HOLIDAY] as Holiday,
Date
FROM
C:\Users\121012355\Desktop\holidays.xlsx
(
ooxml, embedded labels, table is Sheet1);

tmpConcat:
LOAD
concat(chr(39) & Date & chr(39),',') AS HolidayDates
RESIDENT tmpHoliday;

LET vHol = fieldvalue ('HolidayDates',1);

select statement with:

Interval(
rangesum(
NetWorkDays(sts_start_date+1,sts_end_date-1,$(vHol)) * MakeTime(8)
,
if(NetWorkDays(sts_end_date,sts_end_date,$(vHol)),Rangemin(rangemax(frac(sts_end_date),maketime(9)),maketime(17))-Rangemax(rangemin(frac(sts_end_date),maketime(9)),maketime(9)),0)
,
if(NetWorkDays(sts_start_date,sts_start_date,$(vHol)),Rangemin(rangemax(frac(sts_start_date),maketime(17)),maketime(17))-Rangemax(rangemin(frac(sts_start_date),maketime(17)),maketime(9)),0)
,
if(NetWorkDays(sts_start_date,sts_start_date,$(vHol)) and floor(sts_start_date)=floor(sts_end_date),-MakeTime(8))))as

Status_WorkingHours_Cal

0 Replies