Qlik Community

Qlik Education Discussions

Discussion Board for collaboration related to Qlik Education.

ronitfromvgold
New Contributor II

"share" expression in a chart

HI,

The data I have is a product, its sales in each quarter and year.

One bar-chart tells me each product sales in each period - sales.

In the second bar-chart I wish to show the share of each product.

I have tryed with the expression "sum(sales)/sum(all <quarterinyear >sales)" and marked the field of relative.

As long as I choose only period of time, it gives me the correct percentage.

However, if I choose only one product - it gives me 100%.

I have attached the data and desired results as shown in excel.

How can I fix the expression to get the correct result?

Thanks,

Ronit

Tags (3)
4 Replies
MVP
MVP

Re: "share" expression in a chart

sum(sales) / sum(TOTAL <product> sales)

ronitfromvgold
New Contributor II

Re: "share" expression in a chart

Dear Massimo,

Maybe the example I gave was inccorect. Sorry...

I will need for each product, its share from total sales of all products in the chosen period.

When I show all products, the calculation is correct.

But when I choose only product a (for example) it calculates 100%.

I hope I am more clear now.

Thanks,

Ronit

Employee
Employee

Re: "share" expression in a chart

Can you please try the following:

sum(sales)/sum(all <product> sales)

Thanks

Agis

elena888
Valued Contributor

Re: "share" expression in a chart

Hi,

you can use sum( Sales)/sum(TOTAL <Product> Sales) without Relative option, but check, in Number tab, "show in percentage" and "Fixed to" 0 decimals.

KR,

Elena

Community Browser