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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Get today - 2 working days

I need to make at the time of loading a date variable is set to Day - 2 working days, anyone know how to subtract 2 days excluding Saturday and Sunday

in script? Thank you.

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

LET varTwoDaysBack = FirstWorkDate(Today(),3);

don't forget to end the statement with a semicolon


talk is cheap, supply exceeds demand

View solution in original post

6 Replies
Not applicable
Author

 

=

firstworkdate(today(),3)

Anonymous
Not applicable
Author

Hi,

You can also try NetWorkDays(). To quote from the manual ....

"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 times-tamps.

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"

Not applicable
Author

but how do I put this date in a variable in the script, Set and Let not work ...

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

LET varTwoDaysBack = FirstWorkDate(Today(),3);

don't forget to end the statement with a semicolon


talk is cheap, supply exceeds demand
Not applicable
Author

I need to put single quotes before and after the filter to date, I do this in the script + or &?

Not applicable
Author

I solve this,

chr(39) & FirstWorkDate(Today(),3) & chr(39);

thanks.