# New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Make your voice heard! Participate in the 2020 Wisdom of Crowds® Survey. BEGIN SURVEY
Highlighted
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
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
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

Honored Contributor II

## Re: Creation of Flag depend on Weekend&Monthend

thx - I forgot the monthend

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