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

Avout fabs(),monthend,weekday

Hi All,

fabs(MonthEnd(Today())-  WeekDay( MonthEnd(Today())+1 ))

above expression what it will return.

please help me out this issue, And please explain functionality of each expression.

thanks in Advance.

Regards

prathap.

8 Replies
sunny_talwar

This is what this expression in returning:

Capture.PNG

Not applicable
Author

Hi Sunny,

Thanks for your reply..

i used same expression what you mentioned but it gave output as  28-Feb-2016 23:59:59.

Anonymous
Not applicable
Author

  • fabs( x )

Return the absolute value of x. The result is a positive number.

Examples:

fabs( 2.4 ) returns 2.4

fabs( -3.8 ) returns 3.8

  • MonthEnd( date [, shift = 0] )

Returns a value corresponding to a timestamp with the last millisecond

of the last date of the month containing date.

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'

  • today( [ timer_mode ] )

Returns the date from the system clock

  • weekday( date )

The result is a number between 0-6 (0=Monday).

  • MonthEnd( date [, shift = 0] )

Returns a value corresponding to a timestamp with the last millisecond

of the last date of the month containing date.

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'

So your expression will return for example for today(24/02/2016)

date(fabs(MonthEnd(Today())-  WeekDay( MonthEnd(Today())+1 )),'DD/MM/YYYY')= 28/02/2016

MonthEnd(Today())                  = 29/02/2016

WeekDay( MonthEnd(Today()) = 1


For the correct format, you should try:

date(fabs(MonthEnd(Today())-  WeekDay( MonthEnd(Today())+1 )),'DD/MM/YYYY')

Not applicable
Author

Hi Sara,

Thanks for your reply.

it is very clear now.

regards

prathap.

HirisH_V7
Master
Master

Hi,

check your Date and time using now().

HirisH
“Aspire to Inspire before we Expire!”
sunny_talwar

I guess the difference is due to different weekdays.

Mine is setting WeekDay in the script like this -> SET FirstWeekDay=6;

Yours would be this -> SET FirstWeekDay=7;

Not applicable
Author

Hi All,

Thanks for your replies.

oknotsen
Master III
Master III

Please flag helpful replies as Helpful.

If your question is now answered, please flag the Correct Answer.

If not, please let us know with what part of your question you still need help .

May you live in interesting times!