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: 
marksmunich
Creator III
Creator III

Calendar flag for Previous Year Currenmonth to Date Flag excluding weekends

Dear Experts, 

 

I am trying to figure out how to achive a flag for previous year current month to date and flags should appear on all the working days. here the weekends should be excluded. I currently have a flag which has flags on all days including weekends.

any thoughts or ideas here .

 

Thanks in adavance

Labels (4)
2 Solutions

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

When loading your calendar, use code like this:

LOAD ...
	Date,
	....  as MTDFlag,
	If(WeekDay(Date) = 0 or WeekDay(Date) = 6, 0, 1) as WeekDay,

You could use both codes now in a set expression to achieve your result. To permanently modify MTDFlag, then add this preceding load immediately before the above code:

LOAD *,
	If(MTDFlag And WeekDay, 1, 0) as MTDFlag2,
;
LOAD ...
	Date,
	....  as MTDFlag,
	If(WeekDay(Date) = 0 or WeekDay(Date) = 6, 0, 1) as WeekDay,
	
Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

marksmunich
Creator III
Creator III
Author

Thanks for your reply. I tried to do it front end using the set expression, I have considered the workdays field for this.  and used variables for Previous Year and Month.

Best Regards

M

View solution in original post

3 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

When loading your calendar, use code like this:

LOAD ...
	Date,
	....  as MTDFlag,
	If(WeekDay(Date) = 0 or WeekDay(Date) = 6, 0, 1) as WeekDay,

You could use both codes now in a set expression to achieve your result. To permanently modify MTDFlag, then add this preceding load immediately before the above code:

LOAD *,
	If(MTDFlag And WeekDay, 1, 0) as MTDFlag2,
;
LOAD ...
	Date,
	....  as MTDFlag,
	If(WeekDay(Date) = 0 or WeekDay(Date) = 6, 0, 1) as WeekDay,
	
Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
joseph057292
Contributor
Contributor

 
marksmunich
Creator III
Creator III
Author

Thanks for your reply. I tried to do it front end using the set expression, I have considered the workdays field for this.  and used variables for Previous Year and Month.

Best Regards

M