Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I want show the count the of X and Y. Here I have taken product and country as dimension and if(sum(sales)>56,'X','Y') as expression. I want to add two more columns which will show the count of X and Y. For e.g for product 'a' the count of X should be 2 and the count of Y should be 1.
data used:
test:
load * Inline [
country,product,sales
UK,a,58
UK,b,34
UK,c,45
india,a,56
india,b,81
india,c,78
iran,a,45
];
Thanks,
Saugat
Hi
Try like this
Dimension:
product
=Aggr(Sum(If(sales <= 56, 1)),product)
=Aggr(Sum(If(sales < 56, 1)),product)
country
Expression:
if(sum(sales)>=56,'X', If(Sum(sales) < 56 and Sum(sales) <> 0, 'Y'))
product | # of X | # of Y | country | india | iran | UK |
---|---|---|---|---|---|---|
a | 2 | 1 | X | Y | X | |
b | 1 | 1 | X | - | Y | |
c | 1 | 1 | X | - | Y |