Qlik Community

Qlik Sense Advanced Authoring

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

Highlighted
marksmunich
Contributor 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
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
marksmunich
Contributor 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

3 Replies
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
joseph057292
New Contributor

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

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