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

Month end function

Hi,

can anyone please make me understand how month end function works??

i was checking in help and example was mention like

monthend(4,'2001-07-19')

and output is '2001-08-31' how???

please explain..not able to understand

1 Solution

Accepted Solutions
vvvvvvizard
Partner - Specialist
Partner - Specialist

What you wrote above is incorrect , ignore

Monthend('the_date',0) which will give u the last date of this month

Monthend('the_date',1) which will give u the last date of the following month

Monthend('the_date',-1) which will give u the last date of the previous month


Some examples

monthend ( '2001-02-19' ) returns '2001-02-28' with an underlying

numeric value corresponding to '2001-02-28 23:59:59.999'

monthend ( '2001-02-19', -1 ) returns '2001-01-31' with an underlying

numeric value corresponding to '2001-01-31 23:59:59.999'

View solution in original post

5 Replies
jpenuliar
Partner - Specialist III
Partner - Specialist III

monthend()  returns the last date(of the month) of the target date.

if you do monthend() on today which is 19 May, it will return the last day of May.

The best way to understand functions is to actually use them.

try in a text box:

=monthend(today())  result is 31/05/2015

fvelascog72
Partner - Specialist
Partner - Specialist

In help explains: Returns a value corresponding to a timestamp with the last millisecond of the last date of the month containing date.


Monthend( '2001-02-19' ) returns '2001-02-28'

Instead '2001-02-19'  you can use your Date field.

vvvvvvizard
Partner - Specialist
Partner - Specialist

What you wrote above is incorrect , ignore

Monthend('the_date',0) which will give u the last date of this month

Monthend('the_date',1) which will give u the last date of the following month

Monthend('the_date',-1) which will give u the last date of the previous month


Some examples

monthend ( '2001-02-19' ) returns '2001-02-28' with an underlying

numeric value corresponding to '2001-02-28 23:59:59.999'

monthend ( '2001-02-19', -1 ) returns '2001-01-31' with an underlying

numeric value corresponding to '2001-01-31 23:59:59.999'

abhaysingh
Specialist II
Specialist II
Author

Hi Yusuf,

in the same way could you pls help to understand following functions-

MonthsName,

Monthsstart,

e.g. monthsstart ( 4, '2001-10-19', 0, 2 ) returns '2001-10-01' with an underlying numeric value corresponding to '2001-10-01 00:00:00.000'

not able to understand this example.

kindly revert

Not applicable

Hi Abhay,

Monthstart is same as month end.

monthstart(2001-10-19) returns first day of month 2001-10-01.