Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
cedfoning
Creator
Creator

Filter pane

Hello, 

i have a qlik sense app and i want to have the following : 

let's say i have 2 filters (company name, campaign)
when i filter on company name (lets say XX), i have the possible  & excluded values in the campaign filter 

I ONLY want to have the possible values in the campaign filter

1 Solution

Accepted Solutions
Andrei_Cusnir
Specialist
Specialist

Hello,

 

If my understanding is correct, you are interested in implementing conditional Filter pane, where the options depend on another Filter pane's selection. Depending on the use case scenario that you have, you can also use Variable input objects or the combination of both, Variable Input and Filter pane. Here are some examples of how similar use case scenario can be achieved and you can modify the option that suits best your needs:

 

We have the following dataset:

IMAGE

 

Option 1: Use 2 Filter panes:

 

1. Create one Filter pane with dimension "CompanyName"

2. Create another one Filter pane with dimension the expression:

=If(Match(CompanyName, SubField(GetFieldSelections(CompanyName), ', ')) > 0,Campaign)

 

The function GetFieldSelections() will return the selected values for the field CompanyName and the function SubField() will split the string to parts such as "CompanyA, CompanyB" is going to become "CompanyA", "CompanyB". Then the Match() function will return a value grater than the 0 if the CompanyName exists in the list of split values. In that case you return the Campaign value or nothing.

 

3. Or you can use the expression:

If(WildMatch(SubField(GetFieldSelections(CompanyName), ', '), '*' & CompanyName & '*') > 0, Campaign)

 

Where the logic is similar to the other expression. The only change is the use of WildMatch() instead of Match() function.

 

The results in both situations are:

NONE SELECTED:

IMAGE

COMPANY A SELECTED:

IMAGE

COMPANY B SELECTED:

IMAGE

 

As you can see, based on the selected company you get in the second Filter pane only the options for that company. However, this use case scenario breaks when you select multiple companies.

 

BOTH SELECTED:

IMAGE

 

As you can see it only takes one option for each company. In case you are interested in going with this use case scenario, you will have to play around with the logic of the expressions to get the desired outcome for multiple selected companies. 

 

Option 2: Using 2 Variable input

1. Create 2 variables: vCompanyName and vCampaign

2. Create 2 Variable input objects as Drop down, assign the variables accordingly in  Appearance > Variable > Name and select "Dynamic" for values.

3. For the first Variable input use the expression =Concat(DISTINCT CompanyName, '|')

4. For the second Variable input use the expression =Concat({<CompanyName={'$(vCompanyName)'}>}Campaign, '|')

5. The outcome is:

IMAGE

 

As you can see the first object will give you an drop down option with only the CompanyNames and the second will give you only the Campaign titles for the selected CompanyName.

 

Option 3: Use combination of  Variable input and Filter pane

I believe this is the best option. As it will ensure that the user only selects one CompanyName value and then it will allow the user to select multiple values for the Campaign field, but based on the selected CompanyName

 

1. Create the first Variable Input as mentioned above

2. For the Filter pane use the dimension expression:   =If('$(vCompanyName)' = CompanyName, Campaign, Null())

3. The output is:

IMAGE

 

As you can see you can only select one value for the CompanyName but then you can choose as many Campaigns as you like.

 

I hope that this information was helpful. In case I have misunderstood the use case scenario, please elaborate in details by providing additional information. However, if it has helped you resolve the issue, please mark it as accepted solution to give further visibility to other community members. 

Help users find answers! Don't forget to mark a solution that worked for you! 🙂

View solution in original post

1 Reply
Andrei_Cusnir
Specialist
Specialist

Hello,

 

If my understanding is correct, you are interested in implementing conditional Filter pane, where the options depend on another Filter pane's selection. Depending on the use case scenario that you have, you can also use Variable input objects or the combination of both, Variable Input and Filter pane. Here are some examples of how similar use case scenario can be achieved and you can modify the option that suits best your needs:

 

We have the following dataset:

IMAGE

 

Option 1: Use 2 Filter panes:

 

1. Create one Filter pane with dimension "CompanyName"

2. Create another one Filter pane with dimension the expression:

=If(Match(CompanyName, SubField(GetFieldSelections(CompanyName), ', ')) > 0,Campaign)

 

The function GetFieldSelections() will return the selected values for the field CompanyName and the function SubField() will split the string to parts such as "CompanyA, CompanyB" is going to become "CompanyA", "CompanyB". Then the Match() function will return a value grater than the 0 if the CompanyName exists in the list of split values. In that case you return the Campaign value or nothing.

 

3. Or you can use the expression:

If(WildMatch(SubField(GetFieldSelections(CompanyName), ', '), '*' & CompanyName & '*') > 0, Campaign)

 

Where the logic is similar to the other expression. The only change is the use of WildMatch() instead of Match() function.

 

The results in both situations are:

NONE SELECTED:

IMAGE

COMPANY A SELECTED:

IMAGE

COMPANY B SELECTED:

IMAGE

 

As you can see, based on the selected company you get in the second Filter pane only the options for that company. However, this use case scenario breaks when you select multiple companies.

 

BOTH SELECTED:

IMAGE

 

As you can see it only takes one option for each company. In case you are interested in going with this use case scenario, you will have to play around with the logic of the expressions to get the desired outcome for multiple selected companies. 

 

Option 2: Using 2 Variable input

1. Create 2 variables: vCompanyName and vCampaign

2. Create 2 Variable input objects as Drop down, assign the variables accordingly in  Appearance > Variable > Name and select "Dynamic" for values.

3. For the first Variable input use the expression =Concat(DISTINCT CompanyName, '|')

4. For the second Variable input use the expression =Concat({<CompanyName={'$(vCompanyName)'}>}Campaign, '|')

5. The outcome is:

IMAGE

 

As you can see the first object will give you an drop down option with only the CompanyNames and the second will give you only the Campaign titles for the selected CompanyName.

 

Option 3: Use combination of  Variable input and Filter pane

I believe this is the best option. As it will ensure that the user only selects one CompanyName value and then it will allow the user to select multiple values for the Campaign field, but based on the selected CompanyName

 

1. Create the first Variable Input as mentioned above

2. For the Filter pane use the dimension expression:   =If('$(vCompanyName)' = CompanyName, Campaign, Null())

3. The output is:

IMAGE

 

As you can see you can only select one value for the CompanyName but then you can choose as many Campaigns as you like.

 

I hope that this information was helpful. In case I have misunderstood the use case scenario, please elaborate in details by providing additional information. However, if it has helped you resolve the issue, please mark it as accepted solution to give further visibility to other community members. 

Help users find answers! Don't forget to mark a solution that worked for you! 🙂