# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
BI & Data Trends 2021. Discover the top 10 trends emerging in today. Join us on Dec. 8th REGISTER
cancel
Showing results for
Did you mean:
Highlighted
Contributor III

## 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!

1 Solution

Accepted Solutions
Highlighted
Contributor III

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)

5 Replies
Highlighted
Specialist

Can you share your sample application ?

Highlighted
Contributor III

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

Highlighted
Contributor III

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)

Highlighted
Partner

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)

Highlighted
Contributor III

Thanks, this work for me, too!!!