How do I calculate the percentage of total by category in Power BI?

Calculating the percentage of total by category in Power BI allows users to analyze and visualize data in a more meaningful way. This process involves dividing the total value of a specific category by the overall total value, and then multiplying the result by 100 to get the percentage. This can be done using the “Measure” function in Power BI and is useful for understanding the proportion of a category in relation to the entire dataset. By utilizing this feature, users can gain valuable insights and make informed decisions based on the percentage breakdown of their data.

Power BI: Calculate Percent of Total by Category


You can use the following syntax in DAX to create a new column that displays the percent of a column total by category:

Percent of Team Total = 
'my_data'[Points]
    / CALCULATE (
        SUM ( 'my_data'[Points] ),
        ALLEXCEPT ( 'my_data', 'my_data'[Team] )
    )

This particular example creates a new column named Percent of Team Total that displays the percent of the total of the Points column, grouped by the values in the Team column.

The following example shows how to use this syntax in practice.

Example: Calculate Percent of Total by Category in Power BI

Suppose we have the following table in Power BI named my_data that contains information about points scored by basketball players on various teams:

Suppose we would like to add a new column that shows how much each individual value in the Points column represents as a percentage of the total values in the Points column, grouped by Team.

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

Then type in the following formula into the formula bar:

Percent of Team Total = 
'my_data'[Points]
    / CALCULATE (
        SUM ( 'my_data'[Points] ),
        ALLEXCEPT ( 'my_data', 'my_data'[Team] )
    )

This will create a new column named Percent of Team Total that shows how much each individual value in the Points column represents as a percentage of the total values in the Points column for each team:

If you’d like to display the values as percentages, then click the dropdown arrow next to Format and then click Percentage:

Each of the values in the Percent of Team Total column will now be displayed as percentages:

  • The first Mavs player accounts for 25.88% of all points scored by the Mavs.
  • The second Mavs player accounts for 16.47% of all points scored by the Mavs.
  • The third Mavs player accounts for 22.35% of all points scored by the Mavs.
  • The fourth Mavs player accounts for 35.29% of all points scored by the Mavs.

If we add up each of these percentages, we’ll find that the total is 100%:

Total Mavs Points: 25.88% + 16.47% + 22.35% + 35.29% = 100%.

The same is true for every other team in the table.

Additional Resources

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

x