
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Bar chart with bar percent relative to entire chart
Hi Qlik community!
I have a bar graph that currently displays the counts of incidents. I also have a custom toggle, that when clicked, changes the KPI's on the sheet to a percentage, instead of a count. I want to implement this on a bar graph, but I am having an issue summing up all the values within the bar graph itself. Here is a picture of the current bar graph:
As you can see, the totals of the bars above add up to 42. So when I click the percentage toggle (not shown here), for the first bar at the top I expect to see 10/42*100 which would amount to 23.8 percent. However, I am getting 10/10 which is understandable because it is only counting the total for that dimension/measure combo.
So, does anyone know a calculation that will sum up the values from the entire bar chart, so that I can be able to divide by it to produce a percentage upon toggling?
Any help will be much appreciated!
Mohamed
EDIT/NOTE: The number needs to be dynamic, so I cannot create a static variable!
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This was a lot simpler than I expected it to be and it took me too long to figure it out.
Simple: sum(amount) /sum(total amount)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you share your sample application ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I cannot, unfortunately, as I am working with customer-sensitive production data. The bar chart consists of one dimension and two measures. The two measures are simply distinct counts of two different event types.
Please let me know if there is any more information you might need to better help with this.
Thanks,
Mohamed

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This was a lot simpler than I expected it to be and it took me too long to figure it out.
Simple: sum(amount) /sum(total amount)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well yes if you want to have it on a total of all values of the dimension.
But if you want to know the share per dimension value:
sum(amount) /sum(total <dimension> amount)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, this work for me, too!!!
