Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
archire2102
Partner - Contributor III
Partner - Contributor III

Count of multiple columns with or condition in set analysis

Hi,

I am trying to get the count ID where fieldA and fieldB is not empty AND field1 is not empty OR field2 is not empty OR field3 is not empty with the below expression, but its not working:

=Count({$<fieldA =-{''},fieldB=-{''},field1 -={''}>+

<fieldA =-{''},fieldB =-{''},field2 -={''}>+

<fieldA =-{''},fieldB =-{''},field3 -={''}>} Distinct [ID] )

1 Solution

Accepted Solutions
sunny_talwar

Are you looking to get 13?

Capture.PNG

View solution in original post

17 Replies
sunny_talwar

Why don't you create a flag in the script for this

If( (Len(Trim(fieldA)) > 0 and Len(Trim(fieldB)) > 0 and Len(Trim(field1)) > 0) or

     (Len(Trim(fieldA)) > 0 and Len(Trim(fieldB)) > 0 and Len(Trim(field2)) > 0) or

     (Len(Trim(fieldA)) > 0 and Len(Trim(fieldB)) > 0 and Len(Trim(field3)) > 0), 1, 0) as Flag

and then this

Count(DISTINCT {<Flag = {1}>} ID)

or try this

=Count({$<fieldA = {"*"}, fieldB = {"*"}, field1 = {"*"}>+

<fieldA = {"*"}, fieldB = {"*"}, field2 = {"*"}>+

<fieldA = {"*"}, fieldB = {"*"}, field3 = {"*"}>} Distinct [ID] )

archire2102
Partner - Contributor III
Partner - Contributor III
Author

This is not feasible, as I have many conditions like this, around 20-30

archire2102
Partner - Contributor III
Partner - Contributor III
Author

This one also is not working

=Count({$<fieldA = {"*"}, fieldB = {"*"}, field1 = {"*"}>+

<fieldA = {"*"}, fieldB = {"*"}, field2 = {"*"}>+

<fieldA = {"*"}, fieldB = {"*"}, field3 = {"*"}>} Distinct [ID] )

sasiparupudi1
Master III
Master III

May be try like

<FieldA={'=Len(FieldA)>0'}

sunny_talwar

Would you be able to provide a sample and explain as to what exactly are you hoping to get?

menta
Partner - Creator II
Partner - Creator II

=Count({$<fieldA =-{''},fieldB=-{''},field1 -={''}>+

<fieldA =-{''},fieldB =-{''},field2 =-{''}>+

<fieldA =-{''},fieldB =-{''},field3 =-{''}>} Distinct [ID] )

archire2102
Partner - Contributor III
Partner - Contributor III
Author

Hi Sunny,

Because of security reasons I cant share the file, but the issue is not with comparing it to null as individually the output is correct but only when I am using OR condition the output is wrong.

archire2102
Partner - Contributor III
Partner - Contributor III
Author

Thanks Sasidhar, I tried this but issue is not comparing the field with null but in OR condition.

archire2102
Partner - Contributor III
Partner - Contributor III
Author

Sorry Carlo its not working.