Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
zagzebski
Creator
Creator

Getting a Percent of Total in Bar Graph

I need to do the following in a bar graph:

We have 2 locations and I need to be able to have products on the X-Axis. Each Product will have two bars (one for each location). However the bar for that location will represent only the % of total for that specific location.

As an Example:

Location A total sales = 1,000

Location B total sales = 500

Product A sales for location A = 200

Product A sales for location B = 50

So from the example above:

The bar for location A / Product A would = 200/1000 or 20% for that particular bar

The bar for location B / Product A would = 50/500 or 10% for that particular bar

How would the set analysis work to get sales for a product/ocation dividied by total sales for a location/ all products.

1 Solution

Accepted Solutions
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     Try this.

     Create a bar chart with dimension as product. and expression as below

     Sum(Sales)/ sum (total <Location> Sales)

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!

View solution in original post

4 Replies
Not applicable

Right click on the chart > Properties > Number > Select 'Integer' and then select the 'Show in Percent (%)' checkbox. This should solve the issue.

zagzebski
Creator
Creator
Author

thanks for the feedback. That doesn't solve it because it is showing the percent across all point on the graph. I need it to show the % of total based on EACH locations total.

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     Try this.

     Create a bar chart with dimension as product. and expression as below

     Sum(Sales)/ sum (total <Location> Sales)

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable

Oh, My bad, I did not get the question right. You can use the 'Relative' checkbox under Expressions tab under Chart properties and see if this works. There is also a 'TOTAL' qualifier that can be used. Let me know if this could solve your problem.