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

How to add Holidays as a variable

Hi Fellow Qlik Sense users,

This is probably a simple question, but it is baffling me as I can't find the correct way to add a list of holidays to be used to calculate NetWorkDays.  

All the responses I have viewed, generally show something like this:

NetWorkDays(d1, d2, $(vStatHols))

The first part I fully understand, as that is looking within the data for the start , and end dates, its the bit about the variable I can't work out.

How do I create a table  or data set that would allow me to use  the same data across multiple files without the need to add the holidays as separate entities in a calculated field on each data visualization 

Secondly, where is it placed - a separate data source, or an inline load or is there some other method in which this is picked up.

Apologies for the question, but it would be a massive help if I can get some guidance on this topic.

Many thanks

David 

2 Replies
Steve_Nguyen
Support
Support

not sure if this apply, but i see :

https://community.qlik.com/t5/QlikView-App-Dev/Holidays-exclusion/td-p/1253311

 

Help users find answers! Don't forget to mark a solution that worked for you! If already marked, give it a thumbs up!
lukas_
Contributor III
Contributor III

Hello,

Here is a basic example of how it can work:

set vStatHols = '03/01/2022', '10/01/2022', '11/01/2022';

example:
load 
	NetWorkDays(mindate, maxdate)					as result_1,
	NetWorkDays(mindate, maxdate, $(vStatHols))		as result_2
;
load 
	Date#(mindate, 'DD/MM/YYYY')	as mindate,
    Date#(maxdate, 'DD/MM/YYYY')	as maxdate
inline [
mindate, maxdate
01/01/2022, 15/01/2022
];

result_1 will return 10 while result_2 will return 7 because the three days in the variable fall on working days.

 

To feed this variable, you can enter the dates by hand (but that's not crazy of course).
Otherwise generally public holidays can be generated (depending on the country I guess).

 

Does this help you?