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

Set analysis problem: implicit field value not being accounted

Hi everyone!

It's my second question on the community!

So, I'm developing a few calculated fields, and this time I want a different kind of set analysis:

There's a list of buyers and sellers and qty bought. In the list bellow there are 10 distinct buyers, but only 6 are "unique" buyers (those that bought from only one seller - Seller1, in this example)

What I want is: given there's 10 - 6 = 4 buyers that bought from Seller1 and other buyers, how many of these also bought from Seller2?

When I tried use Set Analysis to consider only the number of buyers that bought from Seller1 that also bought from another set of Sellers...:

Count({<Seller=P({<Seller={'Seller2'}>} Seller)>} Aggr(DISTINCT Seller, Buyer))

...it only shows the unique buyers of Seller2 on the Seller2 line (on a pivot table) and shows zeros on the other sellers.

 

Original table:

BuyerSellerTotalQty
21339965Seller320
21339965Seller12
16631233Seller1291
06967098Seller2185
06967098Seller3114
06967098Seller117
84858307Seller246
84858307Seller180
07272825Seller2345
07272825Seller1460
08050237Seller15
10462976Seller125
62115431Seller19
03728965Seller13
07147692Seller1385
Labels (2)
1 Solution

Accepted Solutions
sunny_talwar

Try this

Count(DISTINCT {<Buyer = {"=Count(DISTINCT Seller) > 1"}, Seller = {'Seller2'}>} Buyer)

View solution in original post

3 Replies
sunny_talwar

Try this

Count(DISTINCT {<Buyer = {"=Count(DISTINCT Seller) > 1"}, Seller = {'Seller2'}>} Buyer)
Liz
Contributor II
Contributor II
Author

When I first saw my first post solution you replied, I realized that this is the solution for all my problems!
On the seller subset part, I modified to retrieve all the possible sellers based on another field with the P() function, and it worked perfectly on my data!
Thank you again!
Let me ask you something: where (on the documentation) is this topic (the way you used an expression inside quotation marks to represent a condition) discussed?
So I can learn more!
sunny_talwar

This post from HIC talks about the search string briefly

A Primer on Set Analysis