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: 
Not applicable

How to write this set analysis

Hi All,

I have the following records

OrderId, IsCommunityMember,IsSeller

1, 0,1

2,0,1

3,1,1

Now the question is I want to count the orders, the condition is If only the  order's Is communityMember =1 or IsSeller=1.

I mean even both 2 columns are =1, that order just can be only counted 1 times.

How to achieve it?

5 Replies
Not applicable
Author

Count({$<IsCommunityMember={1}>+<IsSeller={1}>} Distinct [OrderID])

Not applicable
Author

Hi Donald,

Thanks for your quick reply, as you suggested, it shows the right result.

However, one more related question, there you used distinct to remove the duplicated orders like Order 3, because Both 2 columns are 1.

But If I remove the distinct from you set analysis, it result also is 2 not 3.

I attached the QVW, could you help me again?

Not applicable
Author

If you want only where IsCommunityMember = 1, or IsSeller = 1, but not where both = 1, then use:

Count({$<IsCommunityMember={1}>/<IsSeller={1}>} Distinct [OrderID])

Not applicable
Author

Hi Donald,

What I wanted is, the "1" at least raises in the Column IsCommunity or IsSeller at least 1 times, then take into account.

OrderId, IsCommunityMember,IsSeller

1, 0,1

2,0,1

3,1,1

4,0,0

So for the above samle, we need to remove Order4, because there is no 1 in that 2 columns.

How to achieve that?

Not applicable
Author

I think that's where we started. 

See attached.  I've included a sample of each of the set operators for you to compare.