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: 
Not applicable

Last Month, Last 2 Month and so on filter

Hi,

I have a requirement. Say in my sheet, there will be LED Gauges, different charts which will show data for the current month. Now, I will have 3 buttons at the bottom. 'Current Month', 'Last Month', 'Last 2 Month'. Whenever the user clicks on Last Month, the data in all the charts and gauges changes according to the Last Month and same will happen for the 'Last 2 Month'.

If there will be three months, NOV '10, DEC '10, JAN '11 and assuming JAN to be the current month, then when user click on LAST Month, only DEC '10 data will get filter and when user clicks on 'Last 2 Month' only NOV '10 data will get filter.

Please tell me how to achieve the same.

Thanks.

Regards,

Sachin A.

11 Replies
lironbaram
Partner - Master III
Partner - Master III

hei

just a quick qusetion

why do it with  a button

as you describe why not allow the user to select the month he want

you will get the same result with much simple formulas

Not applicable
Author

Thats simple and nice solution indeed. Is there anyway to make that listbox for month in cyclic fashion ?

If current month is JAN '11

Listbox:Month

Jan 2011

Dec 2010

Nov 2010

---------------------------------------------

If current month is Feb '11

Listbox:Month

Feb 2011

Jan 2011

Dec 2010

The months in the listbox changes dynamically and show 3 months only

Regards,

Sachin A.

lironbaram
Partner - Master III
Partner - Master III

hei

you could use something like

=

aggr(if(Monthyear>=$(=max(Monthyear,3)) ,Monthyear),Monthyear)

Not applicable
Author

Sorry, i didn't understand. Do I need to declare some sort of variables in load script ?

Can you elaborate please with a qvw example ?

Not applicable
Author

Hi,

Please see if the attached sample can help you.

Cheers.

Not applicable
Author

Hi,

Yes, this example will work for me. Can you tell me how to link that code with my Date column say 'Datex' ?

Rest all seems perfect.

Thanks.

Not applicable
Author

Hi,

Just replace the Date field name with Datex and also change to proper table names in the resident load.

Cheers.

Not applicable
Author

Hi,

Please check the qvw and data file.

I m missing somewhere.

Not applicable
Author

Hi,

the issue is your data file doesnt have all the dates, earlier i generated master calendar for all dates in a month.

I changed the data file to todays date as we are comparing with variable today() date.

I modified the dates in data file and little changesin script as well.

Please find the attached.