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: 
googel84
Partner - Creator III
Partner - Creator III

Count on two fileds

Hi everyone, I have an inner table with two fields, let say A and B, such that the values of A could be found also in B and vice versa. I'd like to create a third column C (for example in a pivot table) that counts the distinct values that occur considering the union of A and B.

I tried to think about a set-analysis but I wasn't able to find a syntax.

Any idea?

Thanks

1 Solution

Accepted Solutions
spsrk_84
Creator III
Creator III

Hi,

I tried to achieve the logic what u said at script level since we don't have any union function available in Qv..i tried in that way .Check the code written in the attached file..

Regards,

Ajay

View solution in original post

2 Replies
spsrk_84
Creator III
Creator III

Hi,

I tried to achieve the logic what u said at script level since we don't have any union function available in Qv..i tried in that way .Check the code written in the attached file..

Regards,

Ajay

johnw
Champion III
Champion III

There's probably a simpler expression, but I think this works. It counts both, then subtracts the intersection. Not really sure I understood what you want, though.

count(distinct A) + count(distinct B) - count({<B*=P(A)>} distinct B)