Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Changing data labels to percentages in pie charts

Just starting out with Power BI and really loving it.  I currently have a page that is pointing to demographic cube data and have a pie chart displaying race numbers.  I would like those numbers changed to percentages and in doing research I see that I should create a new column or a new measure.  I am trying to use the DIVIDE method, but keep getting an error.  Can someone offer me direction or help with this?  I wish there was an option in the data labels to just display the number as a percent.  Here is the DAX that I have that is not working: RacePercentage = DIVIDE(count(Demographics[Race1.Race Name1]), all(Demographics[Clients Served Count])) 

 

Thanks for the help and advice

1 ACCEPTED SOLUTION
KGrice
Memorable Member
Memorable Member

Hi @Anonymous. Welcome to Power BI!

 

You're correct that there is no option to display the data labels as a percentage, though the tips that show on hover will show the percent. If you really want them on the data labels, though, you're on the right track with the workaround.

 

When starting out with DAX, it can be helpful to use building blocks and test those at each level, to know if each piece is working. I'm not sure from what you described which fields to use, as there are two different fields used in the DIVIDE. Typically, you'd want to divide the individual count by the whole count, using the same fields. An example:

 

Data

Name               Score

KGrice                  3

guyinkalamazoo  5

 

Measures:

 

Score Sum = SUM(TableName[Score])

 

Total Score = CALCULATE([Score Sum], ALL(TableName[Name]))

 

Score Percent = DIVIDE([Score Sum], [Total Score])

 

Be sure to format Score Percent as a Percentage. With the measure selected in Fields, go to the Modeling tab and click the % button.

 

And here are two pie charts using these measures. The one on the left uses Score Sum in the Values section, and the one on the right uses Score Percent.

 

PieVisuals.PNG

 

You can also vote on the idea here to do this natively without the extra measure.

View solution in original post

3 REPLIES 3
KGrice
Memorable Member
Memorable Member

Hi @Anonymous. Welcome to Power BI!

 

You're correct that there is no option to display the data labels as a percentage, though the tips that show on hover will show the percent. If you really want them on the data labels, though, you're on the right track with the workaround.

 

When starting out with DAX, it can be helpful to use building blocks and test those at each level, to know if each piece is working. I'm not sure from what you described which fields to use, as there are two different fields used in the DIVIDE. Typically, you'd want to divide the individual count by the whole count, using the same fields. An example:

 

Data

Name               Score

KGrice                  3

guyinkalamazoo  5

 

Measures:

 

Score Sum = SUM(TableName[Score])

 

Total Score = CALCULATE([Score Sum], ALL(TableName[Name]))

 

Score Percent = DIVIDE([Score Sum], [Total Score])

 

Be sure to format Score Percent as a Percentage. With the measure selected in Fields, go to the Modeling tab and click the % button.

 

And here are two pie charts using these measures. The one on the left uses Score Sum in the Values section, and the one on the right uses Score Percent.

 

PieVisuals.PNG

 

You can also vote on the idea here to do this natively without the extra measure.

Anonymous
Not applicable

Thanks for the information and the welcome!  I did also see this in the link for the vote that you just sent and it is EXACTLY what I needed

 

" this is actually technically already a thing? if you go to values, and open the drop down and select quick calc, and change the 'show value as' field to % of grand total."

I'm glad that worked for you. I saw the Quick Calc option before posting, but when I tried to test it, I get an Unexpected Error. Seems to happen to me every time, so I sent a frown with feedback.

 

UPDATE: Apparently I wasn't on the latest version and it's fixed there. Updated my version and no longer have issues using that method.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.