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

Filtering via AND + OR

Hello,

I would like to ask you for the first time with a Qlik Sense question, which I can not solve currently.

Database is a table from which I would like to select 2 fields in the visualization. The input of all filters must be optional.

A simplified example of the data structure looks like this (all fields are of alphanumeric type):

Field1          Field2        Field3

Order No.   Test             Result

Each order can have n methods with one result.


My current app provides the following query options:


Display data where:  (test1 with result1) AND (test2 with result2) AND ......... (test6 with result 6)

(So ​​I can query 6 different tests with 6 diffrent results)

I solved this by a 6-times load of the identical table, whereby I renamed the fields in the loadskript.

The app works - even if I do not like this 6-times-load of identical data.


Now to my extension:

In addition to the 12 (optional) AND filters (6 methods with their 6 results), I also want to add the possibility of 12 (optional) OR filters.

eg.: 

(    (test1 with result1) AND (test2 with result2) AND .......     )    OR       ( (test7 with result7)  AND   (test8 with result8)  AND ....      )


Solution:

An experiment in the visualization using IF works to link two OR fields.

If (WildMatch (GetFieldSelections (method1), '*' & result1 & '*') or WildMatch (GetFieldSelections (method2), '*' & result2 & '*'

However, using this type of solution for 12 -UND + 12 OR-linkages is only theoretical, since this construct would no longer be overlooked.

"Set Analysis" only works for aggregate functions. I don't beleave it's possible to use it.


Interesting Link:

I found this link:  http://www.qlikfix.com/2013/10/23/and-or-mode-selections-in-qlikview/

Very interesting. But as a beginner i have my problems to understand 🙂

And i don't wont to imagine how complex the solution would be if the AND and OR  (at the same time !) is implemented. But of course it would be interesting if it would work.


Does anyone have a solution approach?

Thank you very much

1 Solution

Accepted Solutions
bernhard_koehle
Partner - Contributor III
Partner - Contributor III
Author

Hello,

i found a solution for the problem.

Look into: Solution for filtering data by using AND + OR at the same time in Qlik Sense 3.2

There is a sample-app for better understanding.

Regards

View solution in original post

3 Replies
sunny_talwar

Would you be able to share a sample of what you have and provide details of what you are looking to do with that sample?

bernhard_koehle
Partner - Contributor III
Partner - Contributor III
Author

Hallo,

here is an example application with 12 fields which are linked by AND.

For the small amout of data the 12 filters are oversized

You can ask for e.g. orders with  (Test1=FL and result1=100)  and (Test2=NA and result2=10)

>>> order 200

In addition I am looking for the next 12 filters which are OR-linked to the first 12-filters.

I want to ask: orders with  (    (Test1=FL and result1=100)  and (Test2=NA and result2=10)  ) OR    (    (Test7=NA and result7=10)  and (Test8=K and result8=20) and (Test9=CA)    )

>>>> order 100 and 200

Any idea?

Regards

bernhard_koehle
Partner - Contributor III
Partner - Contributor III
Author

Hello,

i found a solution for the problem.

Look into: Solution for filtering data by using AND + OR at the same time in Qlik Sense 3.2

There is a sample-app for better understanding.

Regards