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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Set Analysis syntax

What would be the correct syntax for the below?

count({$<(fielda={'Y'} + fieldb={'N'},fieldc={'Z'}>} Items)

The above gives me syntax error.

Thanks,

Dinesh.

1 Solution

Accepted Solutions
Not applicable
Author

I don't think you need to repeat the fieldCs.

count({$(<fielda={'Y'}>+<fieldb={'N'}>)*
<fieldc={'Z'}>} Items)


You could use any number of FieldCs:

count({$(<fielda={'Y'}>+<fieldb={'N'}>)*
<fieldc={'Z'}>*<fieldd={'R'}>*<fieldzzzztop={'O'}>} Items)


Which should be the same as:

count({$(<fielda={'Y'}>+<fieldb={'N'}>)*
<fieldc={'Z'},fieldd={'R'},fieldzzzztop={'O'}>} Items)


View solution in original post

8 Replies
Not applicable
Author

Almost correct.

count({$<fielda={'Y'},fieldb={'N'},fieldc={'Z'}>} Items)

Anonymous
Not applicable
Author

This is basically an and condition between the 3 fields. What I want is ((fielda=Y OR fieldb=N) AND (fieldc=Z)). I put a + for the union command. Is the above possible?

Thx

Not applicable
Author

i don´t know if is possible....but i find a set analisys material.....and found it!

+
Union
Returns the set of all records that belong to the unioned sets
-
Exclusion
Returns records that belong to the first but not the other of the two set identifiers.
*
Intersection
Returns records that belong to both of the set identifiers.
/
Symmetric Difference
Returns a set that belongs to either, but not both of the set identifiers.


I think the last one is usefull for you.....but i never have been tested!!!!!

Miguel_Angel_Baeyens

Hello,

Try my code in this post.

Hope that helps!

Anonymous
Not applicable
Author

This is very helpful. The only pain I now see is that I have to repeat the code for fieldc in both places. There are many such fieldc's which I need to add & would be nice if I do not have to repeat the code.

Thanks,

Dinesh.

Miguel_Angel_Baeyens

Hi Dinesh,

I don't know if you mean you have lots of expressions to change. If that's the case, give a try to the Settings menu, Expression Overview. From there you can replace some code in your expressions if needed.

Hope that helps.

Not applicable
Author

I don't think you need to repeat the fieldCs.

count({$(<fielda={'Y'}>+<fieldb={'N'}>)*
<fieldc={'Z'}>} Items)


You could use any number of FieldCs:

count({$(<fielda={'Y'}>+<fieldb={'N'}>)*
<fieldc={'Z'}>*<fieldd={'R'}>*<fieldzzzztop={'O'}>} Items)


Which should be the same as:

count({$(<fielda={'Y'}>+<fieldb={'N'}>)*
<fieldc={'Z'},fieldd={'R'},fieldzzzztop={'O'}>} Items)


Not applicable
Author

count({$<(fielda={'Y'} ,fieldb={'N'},fieldc={'Z'}>} Items)