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

how to get number of days for a given month

how to get number of days for a given month

1 Solution

Accepted Solutions
swuehl
MVP
MVP

=Day(Monthend(today(),-1))

View solution in original post

6 Replies
swuehl
MVP
MVP

=Day(Monthend(Makedate( YearField, MonthField)))

Anonymous
Not applicable
Author

thank you Swuehl for your response. Can you please guide me on how to get number of days of previous month. For example current month is may and i need to get number of days for april

Anonymous
Not applicable
Author

and to add one more twist is i  have 3 years of data .But user will not select any year or month . But i need number days for the previous month. Thanks a lot for your help.

swuehl
MVP
MVP

=Day(Monthend(today(),-1))

Anonymous
Not applicable
Author

how to get number of days between year start date and PY month last day. as per above example i should get 120 days as my value.

swuehl
MVP
MVP

I suggest that you look into the date and time functions in QV Help or manual. There are quite a lot of useful functions in QV.

Dates are just numbers (more precise, they have a dual value representation with a text and number part), so you can just calculate with the dates:

=ceil(Monthend(today(),-1))- yearstart(today())