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

Logical OR in QlikView?

Seems like a simple request, but also seems difficult to do.

Say you have 2 list boxes:

State          Season

User wants to see a Sum of some field where State = some value OR Season = some other value.  So for example, Sum number of storms where State = Florida OR Season = Spring.  I know how to hardcode these specific selections using set analysis, but how can I allow the users to rapidly qlik different values?

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Attached is an example showing what Gysbert suggested. I've put the two listboxes in different states so the selections don't interfere with one another.

-Rob

View solution in original post

7 Replies
Gysbert_Wassenaar

You can't use this with just listboxes. A selection in one field may contradict with a selection in another field. In that case the selections in the other field would be cleared. If you have QV11 you can use alternate states for the different listboxes so the selections don't interfere with each other. This can be confusing for the user though if you don't make clear exactly how the setup works. You can use the alternate states in set analysis expressions. You can also try using input boxes with variables and use the variables in the set analysis expression.

The kind of set analysis expression for the logical OR looks like sum({<State={'some value'}> + <Season={'some other value'}>} Value). The + adds the two sets together.


talk is cheap, supply exceeds demand
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Attached is an example showing what Gysbert suggested. I've put the two listboxes in different states so the selections don't interfere with one another.

-Rob

Not applicable
Author

Thank you, both of you.  I had a feeling it would have to be done some way like this.  Now I'm wondering if there can be any easy way to fast swap between AND and OR.  A switch of some sort to dynamically change the "> + <" part of the set analysis with ", ".  Although if there were 5 listboxes, they may want to use something like (A OR B) AND (C OR D) AND E, but at that point, the business user may have to learn set analysis.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

That's an intriguing idea. See attached sample. I believe the set operator in this case will be "*", not ",".

-Rob

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

There are examples and discussion on this topic over on this thread also: http://community.qlik.com/docs/DOC-5113

Use of multiple states certainly seems like a good way to de-couple selections from the rest of data model, and Set Analysis provides a neat mechanism for pulling things back together again.

-Steve

barryharmsen
Luminary Alumni
Luminary Alumni

I created a solution that doesn't use alternate states, just set analysis. You can find more information, including the full, reusable expression and a sample application, here: Or-mode selections in QlikView The Qlik Fix!

Anonymous
Not applicable
Author

Barry,

Could you please send me the example QVW for the same. I was unable to implement the solution specified above.