Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Attend QlikWorld 2020 and hear keynote speaker, Malcolm Gladwell. Register by February 29th to save $200. Learn More
mohan2391
Contributor II

Creation of Flag depend on Weekend&Monthend

Hi,

I have a requirement that i need to generate a flag for a date field

-- when the month end date falls on week end --> Flag=1

-- when the month end falls on other than week end --> Flag=0

Ex: If Jan 31 falls on Sunday (Last day of the week) -- Flag=1      (Let's consider week starts from Monday)

       If Jan 31 falls on other than Sunday ( not last day of the week) -- Flag=0

How to achieve this ?

Thanks

4 Replies
Highlighted
mwoolf
Honored Contributor II

Re: Creation of Flag depend on Weekend&Monthend

if(num(weekday(Date))=5 or num(weekday(Date))=6,1,0) as Flag

Highlighted
rupamjyotidas
Valued Contributor

Re: Creation of Flag depend on Weekend&Monthend

if(num(weekday(Monthend(Date)))=5 or num(weekday(Monthend(Date)))=6,1,0) as Flag

Highlighted
mwoolf
Honored Contributor II

Re: Creation of Flag depend on Weekend&Monthend

thx - I forgot the monthend

Highlighted
Partner
Partner

Re: Creation of Flag depend on Weekend&Monthend

If you will consider the weekend :

if((DayEnd(Date)=MonthEnd(Date) and (weekday(Date)>4 ), 1, 0)

If you will consider only sunday:

if((DayEnd(Date)=MonthEnd(Date) and (weekday(Date)>5 ), 1, 0)