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: 
Not applicable

Why MonthEnd don't work in this case?

I wonder how I compare two dates when I use the function monthend, when using in an if statement always gives false, for example:

=if(monthend('31/10/2013') = '31/10/2013', 1,0)

Thank you.

1 Solution

Accepted Solutions
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

It will work

=if(Floor(monthend('31/10/2013')) = Num(Date('31/10/2013')), 1,0)

View solution in original post

7 Replies
jonasheisterkam
Partner - Creator III
Partner - Creator III

Monthend is the timestamp of the last ms. Floor(monthend(...))= or Date must be used.

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Monthend returns a numeric date, but needs a numeric date as input. You're comparing it to a string. That comparison will always return False. You need to turn the strings into a dates using the date# function:

=if(floor(monthend(date#('31/10/2013','DD/MM/YYYY'))) = date#('31/10/2013','DD/MM/YYYY'), 1,0)


talk is cheap, supply exceeds demand
Not applicable
Author

Worked for a fixed date, but when I put the script, using a date in a table, all return 0 ...:

MonthEnd.png

if(floor(monthend(date#(DATA,'DD/MM/YYYY'))) = date#(DATA,'DD/MM/YYYY'), 1,0)

MayilVahanan

Hi

Convert both as number and check it.

Hope tat helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Worked in an expression within a list, but in the script all dates were 0

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

It will work

=if(Floor(monthend('31/10/2013')) = Num(Date('31/10/2013')), 1,0)

Not applicable
Author

Thanks!