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: 
ogelnisan
Contributor
Contributor

Need help

I am new to qlikview and Need help. I want to Check if for Example today -2 days was a Holiday (all written down in table Holiday) and then just give a Feedback. I cant even Write the if.. Thanks for the help!

Labels (1)
  • Other

3 Replies
edwin
Master II
Master II

i would do this logic in the load script - this way your expressions will be simpler and faster.
i would create a new field in your table where you have your dates (possibly your calendar table) that says whether that date has a holiday 2 days back.  so in your table, you can just test for this field = Yes, 1, or whatever value you used.

to do that left join your calendar with the holidays table (can also be the calendar table - actually should be the calendar table) where you less 2 days so it matches up.

edwin
Master II
Master II

here is a sample code (this just shows you how it can be done)

 

Dates:
load date(today()-iterno()) as Date
while iterno()<100;
load 1 AutoGenerate(1); 

NoConcatenate
Holidays:
load Date, if(rnd=1,1) as isHoliday;
load Date, floor(rand()*20) as rnd
Resident Dates;

inner join (Holidays)
load 1 as isHoliday AutoGenerate(1);

left join (Dates)
load Date(Date+2) as Date, Date as ThisIsTheCorrespondingholiday, isHoliday as HasAHoliday2DaysBefore

resident Holidays;

 

edwin
Master II
Master II

here is a sample look at the resulting  fields:

Screen Shot 2022-05-09 at 12.50.23 PM.png

holidays are 2/4 and 2/7
so dates you are interested in are 2/6 and 2/9 which have holidays 2 days prior

hope that helps