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: 
mohan2391
Creator II
Creator 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
m_woolf
Master II
Master II

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

rupamjyotidas
Specialist
Specialist

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

m_woolf
Master II
Master II

thx - I forgot the monthend

sfatoux72
Partner - Specialist
Partner - Specialist

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)