Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

last working days

if(len([Date Closed])<=0,now(),[Date Closed]) as DT2

Instead of Now() i want to find last working days of [date closed] month.

the date format is- 'mm/dd/yy hh:mi am/pm'

21 Replies
Gysbert_Wassenaar

Is max([Date Closed]) what you're looking for?


talk is cheap, supply exceeds demand
sunny_talwar

May be this:

=WeekStart(MonthEnd([Date Closed]), 5)

jonathandienst
Partner - Champion III
Partner - Champion III

Last working day of the month:

If(Len([Date Closed]) <= 0, FirstWorkDate(MonthEnd([Date Closed]), 1), [Date Closed]) as DT2

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

Isn't [Date Closed] unknown for those records where the condition is true?

Which Month / Last Working Date do you want to use then?

Maybe

FirstWorkDate(MonthEnd(Today()), 1)

jonathandienst
Partner - Champion III
Partner - Champion III

Too true

Maybe this instead


If(Len([Date Closed]) = 0, FirstWorkDate(MonthEnd(Today()), 1), [Date Closed]) as DT2

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


I followed your suggestion and the date is converted into number and I have tried vice versa but it didn't('mm/dd/yy hh:mi am/pm').

sunny_talwar

May be try this:

Date(If(Len([Date Closed]) = 0, FirstWorkDate(MonthEnd(Today()), 1), [Date Closed]), 'MM/DD/YY hh:mm TT') as DT2

Not applicable
Author


Almost reaching.

But-

If we have august data then it shpould come 31st of aug and sep -30th sep.

But it is showing oct -30th

may be we have used today() but inplace of today() if we use Date Closed then it is giving us different result.

sunny_talwar

The problem with using [Date Closed] is that you are saying that if Len([Date Closed]) = 0 (meaning it is empty) then do the first thing which give you null() or 0 as well.

Have you tried this:

Date(WeekStart(MonthEnd([Date Closed]), 5), 'MM/DD/YY hh:mm TT') as DT2