
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 1 | Product 2 | Product 3 | |
Company 1 | 14 | 14455 | 0 |
Company 2 | 0 | 154 | 0 |
Company 3 | 1 | 0 | 0 |
Company 4 | 0 | 14 | 16 |
Thank's for you're help


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @mamar910 ,
So in your case what should be the expected result?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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)
