Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
hobanwashburne
Creator
Creator

End of last month

I currently have the following in my load script:

let vMaxDate = num(makedate(2014,9,30));

How would you write this using the Today function so that vMaxDate is always the last day of the previous month?

1 Solution

Accepted Solutions
Clever_Anjos
Employee
Employee

MonthEnd(Addmonths(today(),-1))

and

floor(MonthEnd(Addmonths(today(),-1))) if you want only the date part (not 23:59:59)

View solution in original post

2 Replies
Clever_Anjos
Employee
Employee

MonthEnd(Addmonths(today(),-1))

and

floor(MonthEnd(Addmonths(today(),-1))) if you want only the date part (not 23:59:59)

JonnyPoole
Employee
Employee

monthend() function is the way to go:

let vMaxDate =  monthend( Today() -1) ;

-->  this will include a timestamp  of 23:59 on the end

let vMaxDate = date(floor(monthend(Today()-1));

--> this will strip the timestamp and store only the date value