Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Count in a pivot table

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.

Capture.PNG

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

1 Reply
MayilVahanan

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 indiairanUK
a21XYX
b11X-Y
c11X-Y
Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.