Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 Julien94
		
			Julien94
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi, I want to count customers with sales > 0 by Product type in a table.
I tried Count({<[Customer] = {"=Sum([Sales]) > 0"}>} DISTINCT [Customer]) but it is ko.
This expression ignores the Product type in the table. Customer X is not counted for Product type A
Thank for your help
data :
| Customer | Product | Product type | Sales | 
| X | 1 | A | 10 | 
| X | 2 | B | -20 | 
| Y | 1 | A | 10 | 
| Y | 2 | B | 10 | 
Result ko :
| Product type | Customers with sales >0 | 
| 1 | |
| A | 1 | 
| B | 1 | 
 Julien94
		
			Julien94
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		finally I got the expected result with this formula :
count(DISTINCT if( aggr( sum(Sales),Customer,[Product type]) >0, Customer))
Remove DISTINCT keyword and see?
 Julien94
		
			Julien94
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		I removed DISTINCT and it is still ko : I have 1 customer for Product type A instead of 2
Create table as follows and show the result?
Dimension : [Product Type]
Expression : Count(If(Sales>0,Customer))
 Julien94
		
			Julien94
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		finally I got the expected result with this formula :
count(DISTINCT if( aggr( sum(Sales),Customer,[Product type]) >0, Customer))
