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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

count over a sum within IF

Hi All,

I want to calculate an expression for counting the distinct product ID where sum of quantity is 3.....

I am not able to write an expression for the same. Please help me with it.

Thanks

Arun

17 Replies
Anonymous
Not applicable
Author

Hi,

Try:

=If((sum(Quantity)='3'),count(Distinct VENDOR_ID)) - For individual count

Or

=If((sum(Quantity)='3'),count(Total Distinct VENDOR_ID)) - For total count of all products

Regards

Neetha

Not applicable
Author

TRIED. But not working.

I took time ID as the dimension and expression stated by you in the above comment but not working.

Anonymous
Not applicable
Author

Can you post the snapshot of the expression please.

Regards

Neetha

Not applicable
Author

Hi Arun,

Load * Inline [

Cat,ProdID,Qty

A,100,2

A,101,4

A,102,3

A,103,5

A,100,3

B,101,5

B,105,3

B,106,3];

Dim :                      Cat

Expression :        =count(if(aggr(sum(Qty),ProdID)=3,ProdID))


Thanks,

Prakash

its_anandrjs
Champion III
Champion III

Try this expression

=count(if( Quantity >= 3,  VENDOR_ID))

Regards

Anand

anbu1984
Master III
Master III

=Count(DISTINCT If(Aggr(Sum(Quantity),VENDOR_ID)=3,  VENDOR_ID))

Anonymous
Not applicable
Author

See attached

Not applicable
Author

Thanks a lot. This expression is working fine.