Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to get previous month first and last date?

Hi,

I would like to limit data that is imported into QlikView and for that we have a XML function that needs startdate=YYYYMMDD and enddate=YYYYMMDD set up.

I can currently change it manually to the first day of the previous month and to the last day of the previous month or take it from a variable. But as people accesing template over web cannot change variable, then reload is using date set there before.

Is there an function to add previous month first date and last date in format YYYYMMDD?

For example today it would give me 20120701 and 20120731.

In September it would give me 20120801 and 20120831?

Thank you in advance for any help!

Mariliis

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

=date(floor(monthstart(addmonths(Today(),-1))), 'YYYYMMDD')

and

=date(floor(monthend(addmonths(Today(),-1))), 'YYYYMMDD')

View solution in original post

3 Replies
Anonymous
Not applicable
Author

=date(floor(monthstart(addmonths(Today(),-1))), 'YYYYMMDD')

and

=date(floor(monthend(addmonths(Today(),-1))), 'YYYYMMDD')

Not applicable
Author

Thank you!

These functions work excactly as I need

david_florian
Contributor
Contributor

date(monthstart(Today(), -1),'YYYYMMDD')