10 Replies Latest reply on Jul 24, 2012 8:21 PM by Jonathan Drummey

# Grand Totals of a 2nd measure at the top of a stacked bar

I have a stacked bar chart based on Sales.  I have the running total of sales in the level of detail.  I want the running totals of sales at the top of each bar.

I tried adding a reference line, but that throws the scale way off.  I also tried making it dual-axis, but no luck.

Any other ideas?  The workbook is attached.

• ###### 1. Re: Grand Totals of a 2nd measure at the top of a stacked bar

Hi Andy,

I'm not exactly sure what the desired value you want at the top of the bars to be. However, one possible idea is to create a calculated field that is the total(sum(Sales)). Then, place this on the label shelf. Right click on it and select Compute Using-->Ship Mode. (This will give the total sales in each column). Then, drag one of the labels to the top of the bar. Right click on each subsequent label and select Mark Label-->Never Show.

Hope this helps a bit!

-Tracy

• ###### 2. Re: Grand Totals of a 2nd measure at the top of a stacked bar

Hi Andy,

In the attached, I took advantage of the fact the % of Total returns 100%, so I created a new calculated field that is just 1.0 and set up a dual axis chart using MIN as the aggregation so it always returns 1. Then the running sum can be at the top of the chart, and the formatting can get cleaned up.

Cheers,

Jonathan

• ###### 3. Re: Grand Totals of a 2nd measure at the top of a stacked bar

Thank you Jonathan!  This is exactly what I needed.  I was close, just never thought about using a 1 calc.  This forum always amazes me.

• ###### 4. Re: Grand Totals of a 2nd measure at the top of a stacked bar

Hi Andy, I've learned a lot from other Tableau users (including your blog posts), I'm glad to help!

Jonathan

• ###### 5. Re: Grand Totals of a 2nd measure at the top of a stacked bar

Andy, I'm with you both. I've always learn more than I teach (even when I'm answering!) And yes I am always 'amazed' at how much knowledge is so freely & generously offered here on the forums.

--Shawn

PS: Congrats on the new position! Coke-to-Facebook you're a big-co type of guy.

• ###### 6. Re: Grand Totals of a 2nd measure at the top of a stacked bar

Sounds like word spreads fast Shawn!

• ###### 7. Re: Grand Totals of a 2nd measure at the top of a stacked bar

Jonathan, I'm going to write this up as a blog post.  I see/get this question a lot.  Don't worry, you'll get the credit.  What link do you want me to use for your profile?

• ###### 8. Re: Grand Totals of a 2nd measure at the top of a stacked bar

Why, thanks! I'm about to go live with my blog later this week, it's http://drawingwithnumbers.artisart.org/.

• ###### 9. Re: Grand Totals of a 2nd measure at the top of a stacked bar

Good work, Jonathan!

One additional thing you may want to consider is changing the mark type of the MIN(1.0) pill to Gantt, and then label alignment to top. This will help if a user ever wants to click on the bar segments, eliminating the change of click-through and the user selecting the hidden mark.

• ###### 10. Re: Grand Totals of a 2nd measure at the top of a stacked bar

Even better, thanks!