# Qlik Sense Deployment & Management

Announcements
Coming your way, the Qlik Data Revolution Virtual Summit. October 27-29. REGISTER
cancel
Showing results for
Did you mean:
Highlighted
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
Highlighted
MVP

May be this

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

3 Replies
Highlighted
MVP

May be this

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

Highlighted
MVP

The logic could be something like:

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

Highlighted
Contributor

Thanx Sunny!!!