
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
WeekDay holiday or public holiday flag in script
Hi
Qlik Users,
This is my scenario
If a conference is on a public holiday or on weekend that should be counted as ‘Available on Field’.how can i achieve this in script.i have created weekend flag in master calender by using below script.and now i want to create a flag for getting public holidays on weekdays(mon-fri).
If(WeekDay(Date)='Sat'
,1
, if(WeekDay(Date)='Sun'
,1,
0)
) AS WeekEnd_Flag,
I am attaching my table below.
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
you need to manually identify your public holiday dates. Then if you want to see if they are on your weekdays you can do it like this:
IF ( WeekDay(holidaydate)<5, true, false)
Weekday returns dual value (text and numeric), values 5,6 are saturday and sundays (unless you other in FirstWeekDay variable in Main)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
you could try in this way:
Add a variable:
SET Holidays = 'holiday1', 'holiday2';
Then the flag will be:
If(Match(WeekDay(Date),'Sat','Sun')>0 or Match(Date(Date), $(Holidays))>0,1,0) as WeekEnd_Flag;

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If(Match(WeekDay(Date),'Sat','Sun')>0 or Match(Date(Date), $(Holidays))>0,1,0) as WeekEnd_Flag;
is this flag gives weekday holidays and weekend holidays?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, but before you have to set Holidays manually inside the variable

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
can u guide me how to set variable ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You have to add this line in the script before the load:
SET Holidays = 'holiday1', 'holiday2', 'holiday3';
instead of holiday1/holiday2/holiday3/ect you have to write holiday dates.
