Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

OmarBenSalem
Esteemed Contributor

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

Re: Be sure that we're in working day..

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)

7 Replies

Re: Be sure that we're in working day..

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
Esteemed Contributor

Re: Be sure that we're in working day..

That obviously worked Thanks sun !

andrespa
Valued Contributor

Re: Be sure that we're in working day..

Maybe something like this:

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

Hope it helps,

Andrés

OmarBenSalem
Esteemed Contributor

Re: Be sure that we're in working day..

Every contribution is to salute Andrès !

Thanks !

OmarBenSalem
Esteemed Contributor

Re: Be sure that we're in working day..

Sun,

What baout Last Year?

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

?

Re: Be sure that we're in working day..

Seems like it, right?

Re: Be sure that we're in working day..

Although, this might be eased down to this

Year

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

Month

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

Community Browser