Qlik Community

Qlik Sense Advanced Authoring

Discussion board where members can learn more about Qlik Sense Advanced Authoring.

Announcements
Qlik Analytics Tour 2020 Online. Begins August 10th. Register Today
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
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 (3)
2 Solutions

Accepted Solutions
Highlighted
MVP
MVP

Re: Calendar flag for Previous Year Currenmonth to Date Flag excluding weekends

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

Highlighted
Creator III
Creator III

Re: Calendar flag for Previous Year Currenmonth to Date Flag excluding weekends

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
Highlighted
MVP
MVP

Re: Calendar flag for Previous Year Currenmonth to Date Flag excluding weekends

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

Highlighted
Contributor
Contributor

Re: Calendar flag for Previous Year Currenmonth to Date Flag excluding weekends

 
Highlighted
Creator III
Creator III

Re: Calendar flag for Previous Year Currenmonth to Date Flag excluding weekends

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