Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
arixooo123
Creator III
Creator III

percentage of each segment in Stacked Bar chart

Hello dears,

My Data set is about status of customers in the different countries, I have added Countries and CustomerStatus fields as dimensions and Count the customers in the expression. to see the percentage of each status in country i set the expression as : count(customers)/count(total customers)

as you can see in the below image, I have a Stacked bar chart.  the problem is the number of customers in each country affects the height of bars, i want to see all the bars at an equal height and instead see the percentage of each status in the bar.

how can i do that?

real.PNG.png

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

Check enclosed file...

View solution in original post

15 Replies
MK_QSL
MVP
MVP

Create a Bar Chart

Dimension

Country

CustomerStatus

Expression

1)

Just Write

1

Tick Bar and Untick Values on Data Point

2)

count(customers)/count(total customers)

or

Count(customers)

and Tick Relative


Now Untick Bar and Tick Values on Data point..

Update:

Now go to presentation tab and select plot values inside segments...

danieloberbilli
Specialist II
Specialist II

count(customers)/count(total <countries >customers)


or

count(customers)/count(total <countries, CustomerStatus>customers)


ashfaq_haseeb
Champion III
Champion III

Hi,

Go to chart properties --> sort --> Select sort by Y value.

Regards

ASHFAQ

danieloberbilli
Specialist II
Specialist II

on tab Expressions check "Values on Data Points"

on tab Presentation check "Plot Values inside segements"

alex_nerush
Partner - Creator II
Partner - Creator II

as i understand you need something like at the image below. You can use Dual function. See attachment. if you need percentage for particular country - change expression to: sum(Customers) / sum(total<Country> Customers)

Customers.png

arixooo123
Creator III
Creator III
Author

That's great, but why the aggregate of segments percentage in each bar isn't 100%?  i need to have the percentage of each segment in each country.

MK_QSL
MVP
MVP

Check enclosed file...

arixooo123
Creator III
Creator III
Author

i did exactly what you told me, i just don't get it what i missed. what did you do to get the right chart?

2.PNG.png

MK_QSL
MVP
MVP

What are the dimensions names you used?

Looks like you have used Calculated Dimension