Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Ronald_Qlik
Contributor
Contributor

Last sunday of month

Hai all, I try to make a flag for the last sunday of the month

=If(Date([DatFieldName], 'DD-MM-YYYY' )=Date(WeekEnd(MonthEnd(date#([DatFieldName],'DD-MM-YYYY'),)),'DD/MM/YYYY'),1,0) as FlagLastSunday            =>   does not work

it works for WeekStart  = but I need the sunday not the monday

=If(Date([Datum], 'DD-MM-YYYY' )=Date(WeekStart(MonthEnd(date#([Datum],'DD-MM-YYYY'),0)),'DD-MM-YYYY'),1)

Anyone?

Regards,
Ronald

1 Solution

Accepted Solutions
sunny_talwar

May be this

 

If([DatFieldName] = Floor(WeekEnd(MonthEnd([DatFieldName])-6, 0, 0)), 1, 0) as FlagLastSunday;

 

 

View solution in original post

3 Replies
sunny_talwar

May be this

 

If([DatFieldName] = Floor(WeekEnd(MonthEnd([DatFieldName])-6, 0, 0)), 1, 0) as FlagLastSunday;

 

 

tresesco
MVP
MVP

The logic could be something like:

If(Day(MonthEnd(Date))-Day(Date)<=7 and Num(WeekDay(Date))=0, 1,0) as LastSUNFlag

 

Ronald_Qlik
Contributor
Contributor
Author

Thanx Sunny!!!