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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Contif based on sum aggrgated over another field

Hi,

I would like to get monthly count of customers that have sum(amount)>300. There is something wrong with my syntax, but I can't figure out what...

=COUNT(DISTINCT {<Customer={"=SUM(Amount)>300"}>} Customer)

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

The syntax is fine, but you can't use set analysis to calculate this. Try sum(aggr(if(sum(Amount)>300,1,0),Month,Customer))


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

The syntax is fine, but you can't use set analysis to calculate this. Try sum(aggr(if(sum(Amount)>300,1,0),Month,Customer))


talk is cheap, supply exceeds demand
Not applicable
Author

Thanks! My own solution was write separate condition to each month, so that is considerably more elegant.

if(Month='1',count(DISTINCT{<Customer={"=sum({<Month={'1'}>}COMMISSION)>300"}>}Customer),

if(Month='2',count(DISTINCT{<Customer={"=sum({<Month={'2'}>}COMMISSION)>300"}>}Customer),

if(Month='3',count(DISTINCT{<Customer={"=sum({<Month={'3'}>}COMMISSION)>300"}>}Customer),

....