Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

silviaganhao
Contributor II

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
Valued Contributor III

Re: Get associate field of selection

Hi Silvia,

Please try :

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

4 Replies
jpenuliar
Valued Contributor III

Re: Get associate field of selection

Hi Silvia,

Please try :

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

MVP
MVP

Re: Get associate field of selection

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)

silviaganhao
Contributor II

Re: Get associate field of selection

Thank you Jonathan,

It works perfectly

Regards,

Sílvia

silviaganhao
Contributor II

Re: Get associate field of selection

Thank you Sunny,

You answer also works

Regards,

Sílvia