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: 
mamar910
Contributor
Contributor

Nested aggregation not allowed

Hello

I want to count the number of companies that sell the product (1,2,3) ie the amout of sells>0.

I tried  sum(if($(Amount)>0,1,0)), but doesn't work because of nested aggregation.

There'is an example of my data :

 Product 1Product 2Product 3
Company 114144550
Company 201540
Company 3100
Company 401416

Thank's for you're help

2 Replies
agigliotti
MVP
MVP

Hi @mamar910 ,

So in your case what should be the expected result?

The Power of shining a light on the dark side of your data.
Follow me on my LinkedIn | Know Gamma Informatica at gammainformatica.it
GaryGiles
Specialist
Specialist

@mamar910 

I'm not sure what is in your variable $(Amount), but I am assuming it is something like sum(Product 1) or sum(Product 2).

To count Companies that sell a particular Product, you could use:

count({$<Company={"=sum([Product 1])>0"}>} Distinct Company)

If you are using a variable to change the product you are looking for, you would need to fit it into this expression.

If the Amount variable contained [Product 1], [Product 2], or [Product 3], it might look like:

count({$<Company={"=sum($(Amount))>0"}>} Distinct Company)