Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
shree909
Partner - Specialist II
Partner - Specialist II

working days

hi ,

i have a field name with different days.

i want to calculate the  (day and day -1)  date for a pariticular date selected..

for example if i select the 02/01/2013 and i want to calucate the previous 2 days  or 1 day value.

if i use max(date)--- gives one date

if i use date(max(date)-1-- it gives 01/31/2013..

but if the day falls on sat or sun it has to show the friday value ..

is there any function for calculating the value for only working days...

or

i have a one month date from 01/01/2013 to 01/31/2013

when the user selects a particular date  i have to caluate the that days value and previous days value...

but the problem is i want to caluate only for weekdays..

so what should be the expression for previous days calculation ....

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Use the following to get the prior working day:

     FirstWorkDate(Date(Today(1) - 1), 1)

If you have holiday dates in a quoted, comma separated list in variable vHolidays*, then you can use this format to take holidays into account as well;

     FirstWorkDate(Date(Today(1) - 1), 1, $(vHolidays));

For more information on QV working day functions, check out here.

Hope that helps

Jonathan

* ie something like this:

Set vHolidays = '2013/01/01', '2013/03/27', '2013/05/01';

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

3 Replies
Sokkorn
Master
Master

Hi,

Let try with 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.

Regards,

Sokkorn

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Use the following to get the prior working day:

     FirstWorkDate(Date(Today(1) - 1), 1)

If you have holiday dates in a quoted, comma separated list in variable vHolidays*, then you can use this format to take holidays into account as well;

     FirstWorkDate(Date(Today(1) - 1), 1, $(vHolidays));

For more information on QV working day functions, check out here.

Hope that helps

Jonathan

* ie something like this:

Set vHolidays = '2013/01/01', '2013/03/27', '2013/05/01';

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
shree909
Partner - Specialist II
Partner - Specialist II
Author

Thank You guys...:)