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

Need to select values in a filter based on selections made on another filter.

Hi All,

I'm using two filters (Month, Period). The values of Month filter are (1Month,3Months,6Months,9Months,12 Months) and values of Period Filter are (Mar-21,Feb-21,Jan-21.......Apr-20). If I select 1 Month then Period Filter must automatically select Mar-21.  If I select 3 Months then Period Filter must automatically select Mar-21,Feb-21,Jan-21. If I select 6 Months then    Mar-21,Feb-21,Jan-21,Dec-20,Nov-20,Oct-20 must be automatically selected in Period Filter. Is there any solution for this or any other way to achieve this?

Thanks in advance.....

7 Replies
jbhappysocks
Creator II
Creator II

You can't make a filter selection trigger a selection in another field.

One solution to achieve the same result would be to use Buttons, create 5 buttons and add actions to make selections in Period.

You can also achieve something similar in your data model by connecting Month and Periods as you described it. When selecting 3Months that will limit your data to the 3 Periods, but it would not select the months in the field Period.

Vinith_Kumar
Contributor II
Contributor II
Author

Hi Jbhappysocks,

                                    Thanks for your reply. Can you please explain a bit more in detail about creating 5 buttons and adding actions to make selections in Period.

sasikanth
Master
Master

HI, 

If possible, derive Month filter based on period filter/ corresponding date field.

 

like, 

if( Transdate>='01-Mar-2021' and Transdate <= '31-Mar-2021' , '1 Month',

if( Transdate>='01-Jan-2021' and Transdate <= '31-Mar-2021' , '3 Months',

.

.

.

)))) as Month_Filter

 

jbhappysocks
Creator II
Creator II

Everything you need to know about buttons should be available here:

 

https://help.qlik.com/en-US/sense/May2021/Subsystems/Hub/Content/Sense_Hub/Visualizations/Button/but...

jbhappysocks
Creator II
Creator II

if( Transdate>='01-Mar-2021' and Transdate <= '31-Mar-2021' , '1 Month',

if( Transdate>='01-Jan-2021' and Transdate <= '31-Mar-2021' , '3 Months',

 

The problem with this logic is that a data in March needs to be connected to both 1 Month and 3 Month, here a date in March would be true for the first control and you would never get to the second control. 

You would get

March - 1Month

Feb - 3 Months

Jan -3 Months

Dec - 6 Months and so on

 

If you want to create a filter with the combinations you will need to do it outside of wherever your Date field and make sure you do it in a way so that

March - 1 Month

March - 3 Months

March - 6 Months

March - 12 Months

Feb - 3 Months

Feb - 6 Months

Feb - 12 Months

etc.

This is absolutely doable, but I would recommend OP keep to the Buttons unless there is a really good reason for having it as a Field. 

 

 

 

Vinith_Kumar
Contributor II
Contributor II
Author

Thank you!...I will try using buttons.

sasikanth
Master
Master

@jbhappysocks , @Vinith_Kumar 

My previous response was an example to derive the logic, anyway thanks for your correction,

a simple resident load would help in this case, 

 

TEMP:
CrossTable (FieldFlag, MonthFilter,1)
load [Trans Date],
if([Trans Date] >='3/1/2021' and [Trans Date] <= '3/31/2021','1 Month' ) as OneMonth_flag,
if([Trans Date] >='1/1/2021' and [Trans Date] <= '3/31/2021','3 Months' ) as ThreeMonth_flag,
if([Trans Date] >='10/1/2020' and [Trans Date] <= '3/31/2021','6 Months' ) as sixMonth_flag
Resident Master_Table;

 

 

Hope this helps,

Sasi