Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

count number of rows per category in pivot table

hi guys,

i have a pivot table with this hierarchy

category
   product
     total

i wish a column which shows the number of products for each category. can you redirect me to a thread if my question is a duplicate?

1 Solution

Accepted Solutions
swuehl
MVP
MVP

B1-2 seems to me a subset of B1-1 when I look at the table where you link Z3ARGOS_BLOC to PLANIF.

So the numbers seems ok to me.

View solution in original post

17 Replies
swuehl
MVP
MVP

You probably need to look into using the total qualifier with a field list (check the Help for this), like:

=count(total<category> product)

Hope this helps,

Stefan

MayilVahanan

hi,

     Try this, it gives number of product in a category

     =Count(Distinct Product)

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

hi stefan,

i have tried using the count(total<category> product) but its not good:

here is a sample of what i am trying to achieve:

categorySubcategoryproducttotal products
AXAX11
AXAX21
total products 2
AZAZ1
total products 1
BM41
BM51
total products 2
BO61
total products 1

can you help me?

swuehl
MVP
MVP

In my expression, category and product must be field names, not e.g. column labels.

Your above table shows what you want to achieve or what you see in real life using my expression?

If that's what you want to achieve, I think you should maybe use mayilvahanan's expression count(distinct product) and add a partial sum in presentation tab for your first dimension.

If this does not help you, could you upload a small sample?

Not applicable
Author

my expression is count(distinct product) (label>>"Total")

but when i go to presentation tab> i cannot add partial sum to "Total"

why is that?

swuehl
MVP
MVP

Add the partial sum to your first dimension.

Not applicable
Author

please guys can you check the file i just uploaded? my internet is a bit slow..that's why i took so much time..

its not working when i pu the partial sum on the first dimension

Not applicable
Author

for example

when i expand BLOC1 i have B1-1 and B1-2 and i have total 264 for each.

but this is false because when i collapse BLOC1 i have 264.

swuehl
MVP
MVP

Sorry, my mistake, you need to add the partial sum for the last dimension, Product.