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

Stacked Bar Chart

I have a stacked bar chart and I want to show the total of all of the stacked bars in text above the bar. Meaning if there are three stacked bars and the first one has a total of 100, the second bar has a total of 50, and the third bar has a total of 50 I want to display 200 in text on top of the the stacked bars.

How do I do this?

Thanks,
Stephen

6 Replies
matt_crowther
Luminary Alumni
Luminary Alumni

This may be over simpliyfing the solution but checking the 'Values on Data Points' box under the Expression tab seems to work with my stacked Bar Charts.

Hope that helps,

Matt

Not applicable
Author

When I do that only the total for the top bar shows. The bottom two show nothing. But I want to show the total of all three bars.

Stephen

matt_crowther
Luminary Alumni
Luminary Alumni

My simple solution seems to only work when you have 2 dimensions and one expression.

So I assume you have more than one expression against your single dimension. In this case what I've tried is as follows:

Assuming our dimension is say 'Year' and our first Expression is say '=sum(Sales)' and our second is '=sum(Bonuses)' I'd leave those 2 expressions with the 'Values on Data Points un-checked and create a 3rd expression; '=sum(Sales)+sum(Bonuses)' set this to be neither a line or a bar but check the 'Values on Data Points' this should now display the total for each stacked bar.

This principal should work no matter how many expressions you're stacking.

Hope that cracks it,

Matt

Not applicable
Author

Thanks Matt - that works.

Stephen

juraj_misina
Luminary Alumni
Luminary Alumni

Hi,

I just came across this post when trying to achieve the same. I have a stacked bar chart with summary of activities per month, summing up duration of activities within a month. I have two dimensions (MonthYear, Activity) and one expression (sum(duration)). What worked for me was add second expression with TOTAL modifier to leave out Activity dimension, like this:

sum(TOTAL<MonthYear> Duration)

This is not displayed as bar, but only as value on datapoint.

Not applicable
Author

Presentation Tab > Text in Chart >      ='Total = '&num(sum(Value),'0')

Regards-Bika