Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
majdi14789
Contributor III
Contributor III

Calculate the average of working days of production

Hello all,

I would know please how can i calculate the average day of working to produce some articles,

Our factory is closed just Sundays

I tried two methods but it wasn't correct 🙂

First One : AVG(interval(date of creation - date of sending ,'d')) - this formula take into account Sundays so not accurate

Second one : i used the networkdays function,but this function don't take in account the Saturday,our factory work in this day

I have the idea to create a calendar based on all sending date(working days so :-)),and after exclude all days that not included in this calendar,but i asked this question here,maybe a can found another solution not complicated,

Any suggestion please,

Thank you in advance,

2 Replies
Digvijay_Singh

I think you need to create flags in script to mark working day or holidays and use set analysis in measures to filter relevant records.

Re: NetworkDays with Saturday

majdi14789
Contributor III
Contributor III
Author

Hello Digvijay,

Thanks for your reply,good idea,but doesn't work for me :/,

My application is in real-time so i take just orders that has been dispatched this day and until now or they still in machine,

An exemple : Product X

                      Creation_date : 01/03/2018

                      Dispatched_date: 15/03/2018

                      if (weekday(Dispatched_date) = 'Sun',0,1) as Is_Working_day ,

                      if (weekday(Creation_date ) = 'Sun',0,1)     as Is_Working_day_v1

So working date = 1 and Is_Working_day_v1 =1 also,

My formula is :

avg({<Is_Working_day = {1},Is_Working_day_v1 = {1}>}round(Interval(Dispatched_date-Creation_date ),'d'))