# New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
NEW webinar Dec. 7th: 2023 Outlook, A Pivotal Year for Data Integration SIGN ME UP!
cancel
Showing results for
Did you mean:
Contributor III

## Calculate sales percentage based on a group of selected products: denominator issue

Hi Everyone

I'd need some help with the following expression. I need to select some products and then calculate the percentage of sales based on the current selection --> sales of selected products / Total sales of selected product lines. Nothing difficult. But every product belongs to a different product line.

product 1 --> product line 1

product 2 --> product line 2

product 3 --> product line 3

So, if I select only product 1 and product 2, I'd need in the denominator only the total of product line 1 and product line 2.

Formula: sum({\$<year={2019}>} [quantity product]) / sum({<year={2019}, Product=>} total [quantity product]) doesn't work because it returns to me a denominator with ALL the values including the product line 3.

Is there anyone that can help me?

Labels (3)

• ### Set Analysis

1 Solution

Accepted Solutions
MVP

May be this

``````Sum({\$<year = {2019}>} [quantity product])
/
Sum({\$<year = {2019}, Product, ProductLine = p(ProductLine)>} [quantity product])``````

Or this if you are doing this in a chart where ProductLine is a dimension

``````Sum({\$<year = {2019}>} [quantity product])
/
Sum({\$<year = {2019}, Product, ProductLine = p(ProductLine)>} TOTAL <ProductLine> [quantity product])``````

2 Replies
MVP

May be this

``````Sum({\$<year = {2019}>} [quantity product])
/
Sum({\$<year = {2019}, Product, ProductLine = p(ProductLine)>} [quantity product])``````

Or this if you are doing this in a chart where ProductLine is a dimension

``````Sum({\$<year = {2019}>} [quantity product])
/
Sum({\$<year = {2019}, Product, ProductLine = p(ProductLine)>} TOTAL <ProductLine> [quantity product])``````

Contributor III
Author

it worked perfectly.

Thanks a lot!

Tags
Community Browser