Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Count number of days in previous month

Dear Friends

I need to calculate number of days of previous month.

For example:  If selected month is May , then it should return number of days in April, ie 30.

Below correctly gives number of days for current month. But I need previous month.

num(Monthend(max(DATE_OF_ISSUE)) -Monthstart(min([DATE_OF_ISSUE])))



Kindly help. Thanks in advance.



Regards

Chintan

1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

Just try below

=Day(Monthend(Addmonths(Today(),-1)))

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

14 Replies
kamal_sanguri
Specialist
Specialist

refer this document.

Anonymous
Not applicable
Author

Dear Kamal

Thanks for your reply .It is not working fine for few of the months like Sep, Oct, Nov, Dec and Jan.

For other months it works fine.

Regards

Chintan

kamal_sanguri
Specialist
Specialist

oops my mistake, here is the updated one.

Anonymous
Not applicable
Author

Dear Kamal

It is still same. I believe it is because July and August both have 31 days!

Regards

Chintan

kamal_sanguri
Specialist
Specialist

I think I didn't save it before uploading, can you go to script and just update the correct number of days against each month. I am in meeting sorry. The problem is I put incorrect number of days for the months.

Anonymous
Not applicable
Author

You have taken correct in script. But it does not calculate correctly in the text object

vinieme12
Champion III
Champion III

Just try below

=Day(Monthend(Addmonths(Today(),-1)))

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
sunny_talwar

Can be further shortened into this

=Day(MonthEnd(Today(), -1))

Anonymous
Not applicable
Author

Thanks for your reply Vineeth and Sunny.

=Day(Monthend(Addmonths(Today(),-1)))  and

=Day(MonthEnd(Today(), -1))

both above expression will work only for current month right?  Like as months keep on passing
it will keep showing previous month?


Regards
Chintan