7 Replies Latest reply on Dec 21, 2017 11:50 AM by Lyndsay White

# Include Grand Totals on Bar Graph Filtered by Year

Hello!

I have been searching high and low and haven't been able to find a solution.

I have the following.....(bar graph below) What I would like to do is have another category below Non-Exclusive Breastfeeding that is a total of Exclusive Breastfeeding plus Non-Exclusive Breastfeeding but shows per year.

Essentially I want what is shown in the table under "Any Breastfeeding" (which I achieved by using show Row Grand Totals) to show at the bottom of the graph. Any ideas? I feel like this should be easy, but I haven't been able to figure it out.

• ###### 1. Re: Include Grand Totals on Bar Graph Filtered by Year

You could try making separate calculated fields and plotting them all using measure names/measure values.

Exclusive:

if [Public Health Feeding] = "Exclusive Breastfeeding" then [# of Births - Live] else 0 end

Non-Exclusive

Exclusive:

if [Public Health Feeding] = "Non-Exclusive Breastfeeding" then [# of Births - Live] else 0 end

you can then use sum([Exclusive]), sum([Non-Exclusive]), and sum([# of Births - Live]) to represent your three quantities.  The last one is your "Any Breastfeeding" value.

Add measure names and YEAR(DOB) to rows and measure values to columns.

1 of 1 people found this helpful
• ###### 2. Re: Include Grand Totals on Bar Graph Filtered by Year

Easiest way is to make two sheets and position them on a dashboard together.  In fact, do that even if you want the totals laid out the same as the first chart.

Tableau sheets work on a dimensionally-oriented basis.  The first sheet breaks apart the way you see because there are two values in [Public health...] dimension.  You don't have a "Total" value in that dimension to display a third chunk.

Also, if you have a second sheet, you can scale the TOTAL sheet so that it doesn't dominate the other data.  The non-exclusive bars would end up being rather tiny relative to the TOTAL bars.

However, having said all that, you could create three separate measures -- one for Exclusive, one for Non-Exclusive, and one for TOTAL.  Then you would use the MeasureNames/MeasureValues technique to display three separate measures, and you would be able to generate the viz I think you are describing.

Personally, though, I would go with the 2-sheet technique.

2 of 2 people found this helpful
• ###### 3. Re: Include Grand Totals on Bar Graph Filtered by Year

And Vinnie did a good job of describing the MeasureNames/MeasureValues approach.

• ###### 4. Re: Include Grand Totals on Bar Graph Filtered by Year

Hi Lyndsay,

Are you looking for something like following?

Best,

Jiayi

• ###### 5. Re: Include Grand Totals on Bar Graph Filtered by Year

I agree with Joe and was thinking the same thing.

• ###### 6. Re: Include Grand Totals on Bar Graph Filtered by Year

Thank you Vinnie, this definitely helped me!

• ###### 7. Re: Include Grand Totals on Bar Graph Filtered by Year

Thank you Joe. I like your suggestion and it was what I leaning towards since I know having the total will skew my axis. I appreciate the fast response!