Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Intersection of different sets of value

Hi,

I'm using 2 alternate states for the field 'Brand' in my model.

The first state is a state by default = {$}. Here it is possible to select several Brands.

The second state = {AS}. Here it is possible to select only 1 Brand.

I can get the result of selection in states {$} and {AS} using a concat function.

Set1 = Concat(DISTINCT {$} chr(39) & Brand & chr(39), ',')

Set2 = Concat(DISTINCT {AS} chr(39) & Brand & chr(39), ',')

Note that Set2 can include only one brand.


My task is to define a condition: if Set1 includes Set2 than Result = 1, else Result = 2.


How is it possible to define such a condition in QlikView?


Thank you in advacne,


Larisa



1 Solution

Accepted Solutions
swuehl
MVP
MVP

There is an intersection operator * that enables you to query the intersection of two states:

=if( count({$*AS} Brand)>0,1,2)

View solution in original post

3 Replies
swuehl
MVP
MVP

There is an intersection operator * that enables you to query the intersection of two states:

=if( count({$*AS} Brand)>0,1,2)

Agis-Kalogiannis
Employee
Employee

I couldn't possibly test the following expression, but at least you can use it as a reference for your own expression:

if(isnull(Concat({$*AS}DISTINCT chr(39) & Brand & chr(39), ',')), 2, 1)

I thought that if Set2 is a part of Set1, that the intersection would contain some elements, so the set wouldn't be empty and it wouldn't return null.

As I said, it was my forst thought.

You can work it even more and reach to a solution. 🙂

Thanks

Agis

ALK

Anonymous
Not applicable
Author

Thanks everyone!

I've just tried the simlest approach and it has worked.