Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Create a Calendar skipping Weekend days

Hi everyone!

I will try to explain my issue.

I have maintenance that continues for 6 or 9 or 12 or 20..... days.

E.g.  Maintenance X is for 10 days, so if it starts on  "14/Apr/2015 Tuesday" it should repeat until "27/Apr/2015 Monday" skipping the weekends between this period. ONLY WORKING DAYS, Monday-Friday.


I create a script calendar that follow below:

//-----------------------------------------------------------

LET vDateMin = Num(MakeDate(2015,1,1));

LET vDateMax = Num(MakeDate(2015,12,31));

LET vDateToday = Num(Today());

CALENDAR:

LOAD

Date($(vDateMin) + RowNo() -0) AS  C_DATE

AUTOGENERATE 1

WHILE $(vDateMin)+IterNo()-1<= $(vDateMax);

//--------------------------------------------------------------------------

That Calendar "C_DATE" is working well !



To do not count Weekend days, I create the following script:

//--------------------------------------------------------------------------

WORKING_DAYS:

LOAD (C_DATE),

If(WeekDay(C_DATE) < 5, C_DATE ) as WORK_DAY

Resident CALENDAR;

//-----------------------------------------------------------


The issue with this WORK_DAY, is that it skips the weekend days but count them as maintenance days.

The maintenance can't happen on weekends, so it should skip and continue counting for the next week days.



The chart below is showing a maintenance of 9 days that starts on 27/mar/2015 until 11/mar/2015.

It should show the green bar on 27/fev/2015 skip the weekend until 11/fev/2015


untitled.PNG

Script on Chart Expression:

=COUNT(if([DELIVERY_DATE]+[NEXT_MAINTENANCE_DATE]<= [WORK_DAY],if([DELIVERY_DATE]+[NEXT_MAINTENANCE_DATE]+[DAYS_STOPPED]>=[WORK_DAY],[S/N])))* METER

This issue is related to mariettamstsRepeat values only for workdays



THANKS !!!


1 Reply
jpenuliar
Partner - Specialist III
Partner - Specialist III

try with below:

WORKING_DAYS:

LOAD (C_DATE) as WORK_DAY,

Resident CALENDAR

Where WeekDay(C_DATE) < 5 ;