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: 
David_Capan
Employee
Employee

NetWorkDays for every 2 weeks

Hello everyone,

I'm having an issue trying to organize a date field into buckets and then calculating the net work days within those buckets.

For example:

I want to organize my lone "Date" field into buckets between the 7th and 21st of each month, and then the 22nd to the 6th.

From here I want to use networkdays() to calculate the number of working days in those buckets.  I also want to calculate the total days within the date buckets.

6/7/18 - 6/21/186/22/18-7/6/187/7/18-7/21/187/22/18-8/6/188/7/18-8/21/18
Working Days1111101111
Total Days1515151616

Any assistance would be greatly appreciated.

3 Replies
MK9885
Master II
Master II

Maybe use Apply Map?

Test:

Mapping LOAD * INLINE [

    Day, Bucket

    7, B

    8, B

    9, B

    10, B

    11, B

    12, B

    13, B

    14, B

    15, B

    16, B

    17, B

    18, B

    19, B

    20, B

    21, B

    22, B

    23, A

    24, A

    25, A

    26, A

    27, A

    28, A

    29, A

    30, A

    31, A

    26, A

    27, A

    28, A

    29, A

    30, A

    31, A

];

MasterCalendar:

Load *,

ApplyMap('Test',Day,'Others') as Bucket;

Load

day(YOURDATEFIELDHERE) as Day,

weekDay(YOURDATEFIELDHERE) as [Week Day],

....

...


In front end use Count (WeekDay) as Working Days and Count (Days) as Total Days

David_Capan
Employee
Employee
Author

Hello Shabaz,

I think this is close.  I'd like to get the month before the date number, ideally.  Count of weekday in this case is the same as count(Days) since WeekDay() gives you the name of the day.

MK9885
Master II
Master II

Create a variables for Min and Max Date, use it below...

NetWorkDays($(varMinDate),$(varMaxDate)) as WorkDays,

And count the WorkDays?