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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
VKG
Contributor II
Contributor II

How to exclude holidays from network days for more then one country ?

Hi,

Is it possible to exlcude holidays as per respective country while calcualting lead time between start & end date . 

So sample data as given below.  

Order NoCountryStart DateEnd DateLead time
123UK01-01-2020-01-2011
234Canada02-01-2021-01-2011
456US03-01-2022-01-2013
678UK04-01-2023-01-2013
789US05-01-2024-01-2014
890Canada06-01-2025-01-2014

 

Holiday Table  - 

CountryHoliday
UK01-01-20
UK02-01-20
UK06-01-20
US01-01-20
US02-01-20
US06-01-20
Canada03-01-20
Canada02-01-20
Canada10-01-20

 

I want to deduct country specific holidays as per second table. Is there any way to do so? 

 

Thanks.

Labels (2)
3 Replies
martinpohl
Partner - Master
Partner - Master

I would do:

create three variables:

holidayUK = '01.01.2020','02.01.2020','06.01.2020'

holidayCD = '01.01.2020','02.01.2020','06.01.2020'

holidayUS = '02.01.2020','03.01.2020','10.01.2020'

then in script:

if(Country='US',networkdays,startdate,enddate,$(holidayUS),

if(Country='UK',networkdays,startdate,enddate,$(holidayUK),

if(Country='Canada',networkdays,startdate,enddate,$(holidayCD),networkdays,startdate,enddate))) as Networkdays

Regards

VKG
Contributor II
Contributor II
Author

Thank you for your reply. 

Actually, it's just a sample data. I have a complete database table for country holidays. THis table has around 50 countries with holidays. That will need to use. 

Any way to use table for holiday list. 

martinpohl
Partner - Master
Partner - Master

Yes you can.
Create your variables in script
ConHolidays:
load
Country,
concat(Holiday,chr(39)&','&chr(39)) as HolidayCon
resident table
group by Country;
let Countries = noofrows('ConHolidays')-1;
for tablerow = 0 to $(Contries)
let Country = peek('Country',$(tablerow),'ConHolidays');
let holiday_$(Country) = chr(39)& peek('HolidayCon',$(tablerow),'ConHolidays') &chr(39);
next
so you will get a variable holiday for each country that you can use in your script for networkdays, depending on country in datas.
Regards