Jump to content
We've recently updated our Privacy Statement, available here. ×

adding percentage in stacked bar chart (a complex case)

spotfire newbie_2018

Recommended Posts

I have a complex () case to plot a stacked bar graph with manually calculated (not computer calculated) percentages.

This is a case of a clinical study comparing different clinical indications with the observed clinical symptoms for each clinical indication.

There is a total of 6 different clinical indication 1 - 6.

For each indication, there will be different numbers of cases for each specific clinical symptom, with a total of 6 different symptoms.

The complication stems from the following - for example,

for clinical indication 1, a total of 96 patients were enrolled.

For each patient, we assessed if s/he exhibited specific clinical symptoms and we tallied the number of cases for each clinical symptom.

Due to the fact that patients had overlapping symptoms, the total number of cases for all 6 clinical symptoms combined (n=109) was greater than the number of patients (n=96) enrolled.

Using Spotfire default labeling function to add the percentage of each symptom for each stacked bar, the numbers reflect the percentage of the "total", not the percentage of the "enrollees" (for example, symptom 1 (n=53) for indication 1 (enrollees = 96, total "combined case number" = 109) showed 48.6% (53/109), not the desired 55% (53/96).

While I was able to add to the existing data table new columns with the calculated percentages, I was unable to find a way to use those percentages as the labels in the stacked bar chart.

Attached please find the test spreadsheet and exported slides from Spotfire

Link to comment
Share on other sites


My concern is that a bar chart with labels that do not reflect an actual bar size would be very confusing for consumers to interpret. I suggest showing the two cases side by side. I had to make my own data so I might not have captured exactly what you want to achieve, or structured the data in the same way, but I hope you can see the spirit of it. On the left what you are seeing now, on the right the proportions you wish to show. For instance for Indication 1 and Symptom A we have 6 cases but only 2 distinct patients. Please in the future do add sample data - even if dumb, it makes it easier for the community to answer and therefore increases the chances of people looking into it. Gaia

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...