Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
su_pyae
Creator
Creator

2 Vizlib Filters with default settings to select the latest year and month not working well

Hello everyone, 

I have 2 Vizlib Filter Panes I am using for Year and Month. I was using Default Selections under Interactivity tab to auto-select the latest values of Year and Month using MaxString() function. 

However, I started to have problems when I have '2022' as the Year. Latest Year should be '2022'.

But the data for month starts from June of 2021 till Jan of 2022. Latest month should be 'Jan'.

It is giving me '2021' and 'Dec'. I think it is because I used MaxString() on Month. 

I tried using Sheet actions but it is not giving me what I want. 

Is there a way to achieve what I want with my 2 Filter Panes? 

Thank you so much!

 

Labels (2)
1 Solution

Accepted Solutions
vaisaali
Partner - Contributor II
Partner - Contributor II

I tried using an expression like this on the Month Filter- Default selection setting:
=if(GetSelectedCount(Year)=1,MaxString(Month)) and the filter looks to be working.

Attached is the app I tested with. 


View solution in original post

6 Replies
joe_warbington
Luminary Alumni
Luminary Alumni

Hi @su_pyae - I'm checking with our support team and will respond back here with the solution. 

If possible, could you post the QVF as an example?

vaisaali
Partner - Contributor II
Partner - Contributor II

Hey

May I ask if you tried using just Max() instead of MaxString?
I tried that and it looks to be working for me. Attached my test app.

su_pyae
Creator
Creator
Author

Hi, 

Unfortunately, it is not possible for me to download the test app as QVF file. I have attached the excel file and posted screenshots of how my test app looks like. 

su_pyae_1-1643912333413.png

I use Max(Year) and Max(Month) and select "Set Default(s) on Open" for the filters.

The problem is that sometimes it works (2022, 1) but sometimes, it doesn't (2021, 12). 

 

 

 

su_pyae
Creator
Creator
Author

I tried using Max() as well. 

I think the problem with the 2 filters is that it gives me the correct filter value when Year filter is active before the Month filter. It will give me Dec 2021 when the Month filter is active before the Year filter. 

I tried using IF in the default filter for Month as well but it doesn't do anything. 

vaisaali
Partner - Contributor II
Partner - Contributor II

I tried using an expression like this on the Month Filter- Default selection setting:
=if(GetSelectedCount(Year)=1,MaxString(Month)) and the filter looks to be working.

Attached is the app I tested with. 


su_pyae
Creator
Creator
Author

That works. 

Thank you so much for your help.