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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
macgeorge
Helper I
Helper I

Calculating Percentages

Hi, I am trying to use a measure to produce % of Total column that shows the percentages of Compliant against Priority. I have goine wrong with the code below as it is not showing as a % of 100 - i.e. the first percentage should read 45.4374% (ideally want this rounded up to the nearest percent like 45% as long as the whole table adds up to 100%)
 
% of Total = DIVIDE( [Total Compliant], [All Compliant], 0)
 
PriorityCompliantAll Compliant% of Total
Product 196621260.454374
Product 2321260.001411
Product 33221260.015052
Product 4121260.00047
Product 52321260.010818
Product 661921260.291157
Product 740421260.190028
Product 81621260.007526
Product 96221260.029163
Total2126  

 

Can anyone please help me with this? I am still new to Power BI and figuring things out. 

 

Thank you,

1 ACCEPTED SOLUTION

Hi @macgeorge ,

 

Please try:

% of Total = 
DIVIDE (
    SUMX ( VALUES ( 'Table'[Priority] ), SUM('Table'[Compliant])),
    SUMX ( VALUES ( 'Table'[Priority] ), [All Compliant] )
)

then select the measure ->  measure tools and change the format to percentage:

vcgaomsft_0-1665641807774.png

Result:

vcgaomsft_1-1665641848849.png

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

View solution in original post

6 REPLIES 6
wdx223_Daniel
Super User
Super User

% of Total = DIVIDE( SUMX(VALUES(table[Priority]),[Total Compliant])[All Compliant]0)

Hi Daniel, thank you for your reply. I am still getting 0.45% in that column. I am using this code as you suggested:

% of Total = DIVIDE(SUMX(VALUES(table[Priority]),[Total Compliant]),[All Compliant], 0)
 
Am I doing something wrong here?

=ROUND( DIVIDE( SUMX(VALUES(table[Priority]),[Total Compliant])[All Compliant]0),2)

can this work?

The rounding works, thank you - but I am still not getting the % correct it should read 45% not 0.45%

% of Total = ROUND( DIVIDE(SUMX(VALUES(Table[Priority]),[Total Compliant]),[All Compliant], -0),2)

Hi @macgeorge ,

 

Please try:

% of Total = 
DIVIDE (
    SUMX ( VALUES ( 'Table'[Priority] ), SUM('Table'[Compliant])),
    SUMX ( VALUES ( 'Table'[Priority] ), [All Compliant] )
)

then select the measure ->  measure tools and change the format to percentage:

vcgaomsft_0-1665641807774.png

Result:

vcgaomsft_1-1665641848849.png

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

Thank you so much - this is excellent.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.

Top Solution Authors