Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
praveenkumar_s
Creator II
Creator II

Find nearest monday from the given date

Hi friends,

I want to get the next monday date from the given date like if i have a date called 8/12/2017 . from this date i want to get the next monday date like 11/12/2017 . in the same manner i have to get month last date also like 29/12/2017, i have to get 1/2/2018 in the load script.

Any help is much appreciated friends.

please let me know in case of any clarifications.

1 Solution

Accepted Solutions
Colin-Albert
Partner - Champion
Partner - Champion

This will return today's date if today is a Monday, otherwise the next Monday.

if(num(weekday(<YourDateField>)) = 0,

     <YourDateField>

     date(<YourDateField>+ 7 - num(weekday(<YourDateField>)) )

)

This will return the next Monday

date(<YourDateField> + 7 - num(weekday(<YourDateField>)) )

View solution in original post

6 Replies
swuehl
MVP
MVP

Maybe something like

Weekstart(Max(DateField)+6)

to get next monday for a given date field value (used Max() in case there are more than one possible values).

tamilarasu
Champion
Champion

Hi Praveen,

Try,

Date(WeekEnd(Date#('8/12/2017','DD/MM/YYYY'))+1)

Colin-Albert
Partner - Champion
Partner - Champion

This will return today's date if today is a Monday, otherwise the next Monday.

if(num(weekday(<YourDateField>)) = 0,

     <YourDateField>

     date(<YourDateField>+ 7 - num(weekday(<YourDateField>)) )

)

This will return the next Monday

date(<YourDateField> + 7 - num(weekday(<YourDateField>)) )

prieper
Master II
Master II

give it a try with

WEEKSTART(MyDate) +7

second one is not quite clear

MONTHSTART(ADDMONTHS(MyDate), 1))          should deliver the first day of the next month

praveenkumar_s
Creator II
Creator II
Author

Very thanks, this is exactly what i want.

tamilarasu
Champion
Champion

Or simply try,

WeekEnd(DateField,0,1)