Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Showing percentages in stack bar chart for each stack that is relative to that total bar

Hi All,

I'm facing an issue with the Stack bar chart where I want to show the % for each stack that is relative to the entire bar. I mean if I've 4 stacks in one bar, then I want to show 25% in each stack.

Thanks in advance for your help!!!

9 Replies
Not applicable
Author

I believe, Use the Total Qualifier in the expression

Sum(Sales) / Sum(TOTAL <DIM1> Sales)

Not applicable
Author

If not working please post sample qvw.

Anonymous
Not applicable
Author

Hey Thanks,

Actually after posting the question, I figured out the answer by looking at this post Re: showing values in % but after this bar has changed to 100% stacked bar chart. Is it something can we avoid, I mean we can use the stack bar chart as per the real values but when showing the values in the stacks, then it should show the %.

Thanks!!!

JonnyPoole
Employee
Employee

Does the attach help ?

Not applicable
Author

Can you attach the qvw?

rubenmarin

Hi, you can use Dual function to split the value that defines the high of the bar, and the value shown:

Dual(Sum(Sales), Num(Sum(Sales) / Sum(TOTAL <DIM1> Sales), '#.##0,00%')

Probably you need to set 'Predefined Expression' in Numbers tab

Not applicable
Author

Hi Ruben !

How if i have many dimensions ? By what can i replace DIM1 in your exemple in ordrer to make it bynamic ?

Thank you for your response

Am'

rubenmarin

You can replace DIM1 by your chart expressions, ie:

<DIM1, DIM2...>

To make it dynamic you can create a variable that returns the dimensions string and use this variable, ie:

variable vDimensions = =If(GetSelected...  or =Concat(DimensionSelector, ', ')

// something that returns you the string with dimensions, depens on your model and how works your dynamic chart.

Then use the variable:

Dual(Sum(Sales), Num(Sum(Sales) / Sum(TOTAL <$(vDimensions)> Sales), '#.##0,00%')

Not applicable
Author

Thank you !!