Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Select all previous months in calendar

I have a calendar in my QlikView, on the dashboard I have a year and month selection available.

When entering the QlikView I want the current year and all previous months to be preselected.

Selecting the current year and month is not the problem ... but how do I select all previous months at once??

e.g.

Date now is: 18-03-2013

I want to be preselected the previous months:

Year = 2013

Month = jan, feb

if the date is: 16-09-2013

Year = 2013

Month = jan, feb, mrt, apr, may, jun, jul, aug

Selecting the year is no problem:

Year = year(addmonths(today(),-1))

But how to pre-select all previous months?!?!

Someone got an idea?

rgrds,

Anita

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Found it eventually ... it wasn't as hard as I thought, but it's in the little things.

The answer was simple:

= '<=' & num(month(addmonths(today(),-1)))

rgrds Anita

View solution in original post

7 Replies
sushil353
Master II
Master II

hi,

put a trigger on Open document.

Select in field

='>=' & vfirstmonth & '<=' & vlastmonth

you need to get the vfirstmonth for jan

and vlastmonth= monthname(date)

HTH

Sushil

Anonymous
Not applicable
Author

Did try the following (ofcourse as trigger on open event):

='>=' & month(yearstart(addmonths(today(),-1))) & '<=' & month(addmonths(today(),-1))

doesn't seem to work ...

Not applicable
Author

Hi,

It should work with <$(=NUM(MONTH(TODAY()))) but it seems the $ extension does not work in actions.

When i do a select on the field itself with ❤️ for example, it works.

One workaround is to add a field in the load:

IF(MyMonth < MONTH(TODAY()), 1, 0) AS PreviousMonth

And then do a select for 1 in this field in the action.

Cheers,

Martin

sushil353
Master II
Master II

Please upload a sample dataset or app.

nirav_bhimani
Partner - Specialist
Partner - Specialist

HI,

This Expression return output Year Start date to till date.

here vToday= Date( Today() ) and

= (sum( {<CalDate = {">=$(=Date(Yearstart(max(CalDate)))) <=$(vToday))" }, CalYear=, CalMonth=, CalQuarter= >} Sales))

Regards,

Nirav Bhimani

Anonymous
Not applicable
Author

The issue is nothing more but a calendar ... which I want to preselect when starting the QlikView.

Anonymous
Not applicable
Author

Found it eventually ... it wasn't as hard as I thought, but it's in the little things.

The answer was simple:

= '<=' & num(month(addmonths(today(),-1)))

rgrds Anita