Display % of totals on a stacked bar graph

smcorson
Participant I

I have seen very useful tips on how to show the % of totals in the tooltips when you hover over a stacked bar chart, is there a way to display that % of total on the bar itself rather than in the tooltip?

3 20 8,204
20 REPLIES 20

Hey @smcorson, Thanks for the question. You can display the % of total on the bars by clicking on the viz options, “Values” tab, and then enabling the Value Labels toggle.

Here is a screenshot of a Learn Explore I mocked up showing where this feature can be enabled.

smcorson
Participant I

Sorry, I wasn’t very clear. If I have a stacked bar graph with numbers (not % of total), can I create a value label that shows the % of total rather than the total numbers? In other words, if you changed the bar chart in your example to a stacked chart then the value labels would display round numbers, not % of total. I would like to create a stacked chart with round numbers that showed a value that was the % of total.

@smcorson

Hey Sean,

I was playing around with your question for some time and could not figure out how can we achieve this with Stacked bar graph. However, I managed to create what you wanted with Grouped. I made you the learn account and sharing the link here, so you can test it yourself:

https://learn.looker.com/explore/the_look/order_items?qid=7nZMTq90bqCTbe4kxboEVq&toggle=dat,vis

So percent_of_total is showing up on top of the column and if you hover over the column you can see the actual count number also. You do need to create the percent_of_total column using table calculations. Hope this helps.

But if I am interested in seeing the change over time and how total volume affects percentage, then stacked is a better visual. For example if I have a tiered or bucketed dimension like time (i.e. 2-3 hours, 4-6 hours etc). Found a post where you can do this in excel… https://www.extendoffice.com/documents/excel/2370-excel-show-percentages-in-stacked-column.html

Hey @Patrick_Bibb ! I took a look at your example and this isn’t currently possible. I can definitely pass your use case & feedback along to our product team.

We could however, visualize just the percent of total over time as shown below. Note that the y-axis shows the percentage and not the total, as in your example.

Alex_Hancock
Participant IV

This is a little feature we would also appreciate 🙂

We will also appreciate this feature.

I also think this would be useful, to display the percent of total in the stacked bar tooltip (but keep the y-axis as the actual values)

Same. This would be very useful.

Hi Paola, would you be able to share how you were able to create this? i’ve been working on something exactly like what you made but couldn’t figure it out.

Hey @Catherine_Huang, sure thing!

We can create the percent of total field using Table Calculations. In my example above, I used the function ${users.count}/sum(${users.count})

Once you have that, you can hide the the Users Count column from the visualization. Change the visualization plot settings to “Stacked” and toggle on “Value Labels”.

Hope this helps!

Thank you so much! awesome! is there a way to also show the actual count in the tooltip black box w i hover my mouse over to the bar graph area?

No problem 🙂If you’d like to change what’s displayed in the tooltip, I recommend going through this discourse article which will walk you through how to use Liquid to change those values.

@paola1 Hi, did it resolved yet, do we have a way to show % instead of actual count in stacked bar graph?

This link is broken (like so many others). Is there anything new on this feature? This should  be so common and easy to do.

No problem ?If you’d like to change what’s displayed in the tooltip, I recommend going through this discourse article which will walk you through how to use Liquid to change those values.

Bumping this 5 year old request, hoping there’s some new development.

It would indeed be a nice feature if there were an extra toggle that shows the percentage in the stacked bar graph in the editing section.

Bumping this as well. It would be nice to add table calculations to the displayed callouts.

bumping + 1
this would be very helpful

+1 this would be super helpful

Top Labels in this Space
Top Solution Authors