Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
OmarBenSalem

Be sure that we're in working day..

Hi guys ( stalwar1‌ )

Afer a loong day, I really can't think anymore

so, I really need ur help; the question is rather simple:

if I select a date; I want to go back one Month.

the expression I'm using is:

date( date(Today()-1)- round( MonthEnd(Today()-30)- MonthStart(Today()-30)))

But, with that, going back from 12/12/2017 using this: I got 12/11/2017 which is a sunday.. How can I go back to the closest WORKING DATE (monday or friday) ?

Thanks !

1 Solution

Accepted Solutions
sunny_talwar

To go back to Nov 10th

=FirstWorkDate(Date(Date(Today()-1) - Round(MonthEnd(Today()-30)- MonthStart(Today()-30))), 1)

To go forward to Nov 13th

=LastWorkDate(Date(Date(Today()-1) - Round(MonthEnd(Today()-30)- MonthStart(Today()-30))), 1)

View solution in original post

7 Replies
sunny_talwar

To go back to Nov 10th

=FirstWorkDate(Date(Date(Today()-1) - Round(MonthEnd(Today()-30)- MonthStart(Today()-30))), 1)

To go forward to Nov 13th

=LastWorkDate(Date(Date(Today()-1) - Round(MonthEnd(Today()-30)- MonthStart(Today()-30))), 1)

OmarBenSalem
Author

That obviously worked Thanks sun !

andrespa
Specialist
Specialist

Maybe something like this:

date( date(Today()-1)-networkdays(MonthStart(Today()-30)), date(Today()-1))

Hope it helps,

Andrés

OmarBenSalem
Author

Every contribution is to salute Andrès !

Thanks !

OmarBenSalem
Author

Sun,

What baout Last Year?

=FirstWorkDate(Date(Date(Today()-1) - Round(YearEnd(Today(1))- YearStart(Today(1)))), 1)

?

sunny_talwar

Seems like it, right?

sunny_talwar

Although, this might be eased down to this

Year

=FirstWorkDate(AddYears(Today()-1, -1), 1)

Month

=FirstWorkDate(AddMonths(Today()-1, -1), 1)