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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
siddharth_s3
Partner - Creator II
Partner - Creator II

Count if with aggr

I am trying to find the number of customers whose profit percentage is more than 50%

Basically, count the number of customers whose (Profit/Total) > 50%

What I tried is as follows but did not work:

SUM(Aggr(IF(Profit/TotalSale>0.5,1,0),Customer))

Suggestions please.

1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

Might make sense to throw a distinct in there also

Count(DISTINCT {<customer = {"=Sum(Profit)/Sum(TotalSale) > 0.5"}>} customer)

View solution in original post

4 Replies
OmarBenSalem
Partner - Champion II
Partner - Champion II

Try as follow:

Count({<customer= {"=sum(Profit)/sum(TotalSale>0.5"}>} customer)

mdmukramali
Specialist III
Specialist III

Hi,

Small correction in Omar expression:

Count({<customer= {"=sum(Profit)/sum(TotalSale)>0.5"}>} customer)

OmarBenSalem
Partner - Champion II
Partner - Champion II

what have u corrected?

the missing ) in sum(totalSale) ?

sunny_talwar
MVP
MVP

Might make sense to throw a distinct in there also

Count(DISTINCT {<customer = {"=Sum(Profit)/Sum(TotalSale) > 0.5"}>} customer)