Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
There is an intersection operator * that enables you to query the intersection of two states:
=if( count({$*AS} Brand)>0,1,2)
There is an intersection operator * that enables you to query the intersection of two states:
=if( count({$*AS} Brand)>0,1,2)
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
Thanks everyone!
I've just tried the simlest approach and it has worked.