Skip to main content

Hello! I am looking to create a stacked bar chart with these data. The n_establishments column states how many establishments are in each state, and the columns E-J tell you how many of the establishments had a failing percentage in between two values (0%, 0-10%, 10-20%, etc).

 

For example, for Alabama, there were 27 establishments. 24 of them had a failing percentage of 0%, and 3 of them had a failing percentage anywhere between 10-20%.

 

Calculating percentage of a column with other columns in a stacked bar chart 

I am looking to showcase this information in a stacked bar chart (so for Alabama, the total number of establishments would determine bar height. A portion of the bar equaling 24/27, or ~88%, would be one color, and the remaining portion equaling 3/27, or ~12%, would be another color.) However, I am having trouble with this and have only got to here:

 

work thus far 

Would anybody be able to tell me what I am doing wrong? Thank you!

1 answer
  1. Oct 1, 2025, 9:30 AM

    your data appears to be in a wide format and needs to be pivoted - see - https://help.tableau.com/current/prep/en-us/prep_pivot.htm then the calculation of % total can be done with a table calculation or an lod - see https://jimdehner.com/2023/09/10/table-calculations-when-where-and-how-2/ or https://jimdehner.com/2023/09/09/bgs-session-8-special-calculations-lods/

     

    btw ALWAYS include a twbx with a question to get a more specific response

0/9000