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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Manish
Creator
Creator

Getting max(Date)-7 without including weekends

Hi Guys

I have a requirement where I need to find out (Max(Date) -7) but without considering the weekends.

For example if Max(Date) = 27th Jun 2022 then in that case (Max(Date)-7) should be  "17th Jun 2022" and not "21st Jun 2022".

I want to do this in front end.

I would really appreciate a response.

Labels (2)
1 Solution

Accepted Solutions
TiagoCardoso
Creator II
Creator II

Hi.

Maybe this helps you.

Sample Date generation from Today -1 to past 100 days:

a:
LOAD 
	Date(Today()-1-RowNo()+1) AS Date
AUTOGENERATE 100;

 

Expression used to desconsider the non working days:

DATE(Max({<Date-={"=MATCH(WeekDay(Date)*1,0,6)"}>} Date,7))

 

Result:

TiagoCardoso_0-1656439525678.png

 

View solution in original post

2 Replies
sidhiq91
Specialist II
Specialist II

@Manish  Please use something like below expression

NetWorkDays(Today()-7,today())

Or In your Case I have created 2 Variables: Vstartdate=Max(Date)

                                                                                       V7DaysPrior=Max(Date)-7

Final Expression would be :NetWorkDays($(V7DaysPrior),$(Vstartdate))

TiagoCardoso
Creator II
Creator II

Hi.

Maybe this helps you.

Sample Date generation from Today -1 to past 100 days:

a:
LOAD 
	Date(Today()-1-RowNo()+1) AS Date
AUTOGENERATE 100;

 

Expression used to desconsider the non working days:

DATE(Max({<Date-={"=MATCH(WeekDay(Date)*1,0,6)"}>} Date,7))

 

Result:

TiagoCardoso_0-1656439525678.png