Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
vinay_bangari
Valued Contributor III

Calculate Number of working days between Sundays

Hi All i have a requirement that i need to calculate the working days between two any given sundays. Attached is the QVW file which will have  _FlagWorkingDay column if  _FlagWorkingDay=0 then its not a working day and if  _FlagWorkingDay=1 then it is a working day. Now i want the output like this in my final table should look like i need dates related to sundays and working days related to that sunday. Please let me know in case of any questions. i am attaching the QVW file.

1 Solution

Accepted Solutions
MVP
MVP

Re: Calculate Number of working days between Sundays

see attachment

10 Replies
markodonovan
Valued Contributor

Re: Calculate Number of working days between Sundays

Hi Vinay,

Have a look at the NetworkDays function

networkdays (start:date, end_date {, holiday})

Returns the number of working days (Monday-Friday) between and including start_date and end_date taking into account any optionally listed holidays. All parameters should be valid dates or timestamps.

Examples:

networkdays ('2007-02-19', '2007-03-01') returns 9 

networkdays ('2006-12-18', '2006-12-31', '2006-12-25', '2006-12-26') returns 8 

Thanks

Mark

www.techstuffybooks.com

vinay_bangari
Valued Contributor III

Re: Calculate Number of working days between Sundays

HI Mark, Thank you for your response. Actually i want that calculation need to perform in the script. Here is the challenge i don't have date range i can mention because i will always have 2 to 3 years of data. Another challenge is My working days does not depend on weekdays ( Monday- Friday). Its based on our warehouse working days and that working days will be determined by _FlagWorkingDay. Thanks for your help in advance.

vinay_bangari
Valued Contributor III

Re: Calculate Number of working days between Sundays

Hi All, Any help please

markodonovan
Valued Contributor

Re: Calculate Number of working days between Sundays

Hi Vinay,

Do you mean you need to have the number of working days (_FlagWorkingDay) calculated for a selected date range ?

If not can you give an example of what you would like to see.

Thanks

Mark

anbu1984
Honored Contributor III

Re: Calculate Number of working days between Sundays

vinay_bangari
Valued Contributor III

Re: Re: Calculate Number of working days between Sundays

Hi Anbu & Mark, Sorry if i confuse you guys more. Please see attached screen shot which explains my problem. Please let me know if you need more information.Capture.PNG.png

Re: Calculate Number of working days between Sundays

give example where working days are not zero

vinay_bangari
Valued Contributor III

Re: Re: Calculate Number of working days between Sundays

Hi Kush, I have attached QVW file in my first post. In case if you missed that please find with the attached

MVP
MVP

Re: Calculate Number of working days between Sundays

see attachment

Community Browser