Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
QlikWorld 2022, LIVE in Denver CO., May 16-19, 2022. REGISTER NOW TO RECEIVE EARLY BIRD PRICING
cancel
Showing results for 
Search instead for 
Did you mean: 
OmarBenSalem
Partner
Partner

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)

View solution in original post

OmarBenSalem
Partner
Partner
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
Partner
Partner
Author

Every contribution is to salute Andrès !

Thanks !

OmarBenSalem
Partner
Partner
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)