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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Liz
Contributor II
Contributor II

Sum total from third field after aggr(distinct Field1, Field2)

Hi everyone!

I'm developing a few calculated fields and I'm not able to solve this problem:

There's a list of sellers and buyers and qty bought.

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


First of all, I was able to count distinct and unique buyers (those that buy from only one seller) with a simple Count(Aggr(DISTINCT FieldSeller, FieldBuyers).

There are 10 distinct buyers but it results that only Seller1 has 6 unique buyers (buyers that did not buy from any other seller).

But now I want to sum all the totals bought only by the unique buyers. It means that I want to sum all qty bought only by these 6 unique buyers.

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar

Try these

For Count
Count(DISTINCT {<Buyer = {"=Count(DISTINCT Seller) = 1"}>} Buyer)

For Sum
Sum({<Buyer = {"=Count(DISTINCT Seller) = 1"}>} TotalQty)

View solution in original post

3 Replies
sunny_talwar

Try these

For Count
Count(DISTINCT {<Buyer = {"=Count(DISTINCT Seller) = 1"}>} Buyer)

For Sum
Sum({<Buyer = {"=Count(DISTINCT Seller) = 1"}>} TotalQty)
Liz
Contributor II
Contributor II
Author

Wow! That was fast!
Thank you very much!
It worked perfectly and I learned a new tool I wasn't able to find on the documentation!
sunny_talwar

Awesome, I am glad I was able to help 🙂