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

Get associate field of selection

Hi,

Imagine I have this table:

Category          Product          Quantity

     A                         1                    10

     A                         2                    20    

     A                         3                    30

     B                         4                    40

     B                         5                    50        

     B                         6                    60


I choose Product 1, so the category related to product is A, with the value 10 for Quantity.


I would like to now the percentage of product 1 that was selled in the category A.

So I want Sum of quantity for the product I selected

And then I want Sum of quantity of all products related to the same category that product 1:

     So I want quantity of product 1, 2 and 3, all belonging to category A: 10+20+30 = 60

The question is that the only thing I have selected is Product = 1

bottom of line I want something like:

    Sum quantity where product = PRODUCT SELECTED  / Sum quantity where category = category of PRODUCT SELECTED

How can I achieve this ?

It may be something simple but I'm not getting there.

I will give you more information if this is not enough.

Thanks in advance.

Regards,

Sílvia

    



     

1 Solution

Accepted Solutions
jpenuliar
Partner - Specialist III
Partner - Specialist III

Hi Silvia,

Please try :

=num( sum(Quantity) /  sum({1<Category = {'$(=Only(Category))'} >}Quantity),'#.##%')

View solution in original post

4 Replies
jpenuliar
Partner - Specialist III
Partner - Specialist III

Hi Silvia,

Please try :

=num( sum(Quantity) /  sum({1<Category = {'$(=Only(Category))'} >}Quantity),'#.##%')

sunny_talwar

May be like this:

Text Box:

Sum(Quantity)/Sum({<Product, Category = p(Category)>} Quantity)

Chart: (with Product and Category as Dimensions)

Sum(Quantity)/Sum(TOTAL <Category> {<Product, Category = p(Category)>} Quantity)

Anonymous
Not applicable
Author

Thank you Jonathan,

It works perfectly

Regards,

Sílvia

Anonymous
Not applicable
Author

Thank you Sunny,

You answer also works

Regards,

Sílvia