Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Custom Master Calendar for Each Country

I need to create a custom master calendar for each country based on their weekend. The weekend for each country should be labelled based on the weekend for that country.

My generic calendar -

MinMax:

LOAD

  Min([week]) As MinDate,

  Max([week]) As MaxDate

FROM dates.qvd (qvd);

LET vMinDate = Num(Peek('MinDate', 0, 'MinMax'));

LET vMaxDate = Num(Peek('MaxDate', 0, 'MinMax'));

DROP TABLE MinMax;

TempCal:

LOAD

  date($(vMinDate) + rowno() - 1) As TempDate

AutoGenerate

  $(vMaxDate) - $(vMinDate) + 1;

The country weekend information comes from another table in the below format -

Country_Weekend:

LOAD

  country_id As [Country ID]

  , weekend As [Country Weekend]

FROM country.qvd (qvd);

Weekend can take values like 5,6 or 7.

I will eventually be using this information for calculating the number of working days for each country based on the user selections of dates.

2 Replies
Not applicable
Author

Is that possible to provide app with sample data?

marcus_sommer

I wouldn't generate different calendars else create three different workday-flags within the calendar. I create such workday-flag of 0 or 1 per nested if-loop over weekday and an applymap() to holidays to define if a day is a workday or not and use then simply a sum(workdayFlag) within the ui. In your case you would have three flags which you set manually within the expressions - but this could be also automated matched per pick(match()) expression.

- Marcus