Power BI: Display Percentage in Stacked Column Chart


Often you may want to display percentages in a stacked column chart in Power BI, such as in the following chart:

Power BI show percentage in stacked column chart

Fortunately this is easy to do and the following step-by-step example shows how to do so.

Step 1: Load the Dataset

First, we will load the following dataset into Power BI that contains information about the gender and favorite sport of 20 individuals:

Step 2: Calculate the Percentages

Suppose that we would like to calculate the percentage of each gender that accounts for the total of each sport.

To do so, we can click the Table tools tab along the top ribbon, then click the New measure icon:

Next, type the following formula into the formula bar: 

Percent of Total = 
DIVIDE (
    COUNT('my_data'[Sport]),
    CALCULATE (COUNT('my_data'[Gender]), ALLEXCEPT('my_data', 'my_data'[Sport]))
)

Then click the dropdown arrow next to Format along the top ribbon and choose Percentage:

Step 3: Insert the Stacked Column Chart

To insert the stacked column chart, click the Report View icon on the left hand side of the screen:

Then, on the right side of the screen under Visualizations, click the icon called Stacked column chart:

An empty stacked column chart will be inserted:

Next, drag the Sport variable under the X-axis label, then drag the Gender variable under the Y-axis label, then drag the Gender variable under the Legend label, then drag the Percent of Total measure under the Tooltips label:

This will produce a stacked column chart where the x-axis displays the individual sports, the y-axis displays the total count of individuals who prefer each sport, and the colors represent the gender of the individuals:

When you hover over and individual bar in the chart, a tooltip will appear that shows the count of individuals represented by the bar along with the percentage that the gender represents of the total:

Power BI show percentage in stacked column chart

For example, there were 7 total individuals who preferred basketball as their favorite sport.

When we hover over the dark blue bar for the Basketball category, a tooltip appears that tells us 5 of the individuals were Males, which represented 71.43% of the total individuals (5/7) who preferred basketball as their favorite sport. 

Additional Resources

The following tutorials explain how to perform other common tasks in Power BI:

How to Count Number of Occurrences in Power BI
How to Use “If Contains” in Power BI
How to Write an IF Statement with Multiple Conditions in Power BI

Leave a Reply

Your email address will not be published. Required fields are marked *