Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
alespooletto
Creator
Creator

Obtain effective working days using NetWorkDays()

I am trying to obtain the average of products made within the working days of the period from when I have available data until now, which means for each week, counting the total pieces made and divided by the number of days effectively worked, what was the average produced?

The problem is when I try to obtain the working days measure, as I get it like this currently within my Master Calendar:

MasterCalendar:
LOAD
    Date,
    Year(Date) as Year,
    'Q' & Ceil(Month(Date)/3) as Quarter,
    Month(Date) as Month,
    Week(Date,1,1) as Week,
    Day(Date) as Day,
    NetWorkDays(Min(Date), Max(Date), v$(Holidays)),
    WeekDay(Date) as Weekday,
    MonthName(Date) as MonthYear,
    Year(Date) & '-' & Week(Date,1,1) as WeekYear,
    Year(Date) & '-Q' & Ceil(Month(Date)/3) as QuarterYear 	
   
Resident ActivityLog;

 

In this case, I have a list of holidays that will be omitted. But even if I don't input anything there, I still get an error:

The following error occurred:
Invalid expression
The error occurred here:
MasterCalendar:
LOAD
Date,
Year(Date) as Year,
'Q' & Ceil(Month(Date)/3) as Quarter,
Month(Date) as Month,
Week(Date,1,1) as Week,
Day(Date) as Day,
NetWorkDays(Min(Date), Max(Date)),
WeekDay(Date) as Weekday,
MonthName(Date) as MonthYear,
Year(Date) & '-' & Week(Date,1,1) as WeekYear,
Year(Date) & '-Q' & Ceil(Month(Date)/3) as QuarterYear
 
Resident ActivityLog
---
The following error occurred:
Invalid expression
Labels (2)
10 Replies
Rohan
Specialist
Specialist

Hi @alespooletto ,

The error that you are getting in the script is because you are using aggr() functions without group by clause while using your NetworkDays() function.

Regards,

Rohan.