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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Auski
Helper I
Helper I

DAX Formula for Percentage

Hi all,

 

I have an excel formula that I am hoping to have replicated into DAX format for a measure I have created. I'm pretty new to Power BI so looking for some help if possible 😬

 

The excel formula is: =IFERROR(1-([@exceptiondurationmins]/[@adherenceschedulemins]),0%)

 

I have created 2 measures In Power BI:

Exception Duration Measure = SUM(adherence[exceptiondurationsecs])
Scheduled Seconds Measure = SUM(adherence[adherenceschedulesecs])
 
The DIVIDE calculation will need to be subtracted from 100%. Hope that makes sense
 
Please let me know if any more information is required.
 
Thanks!
 
 
 
1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

Hi @Auski 

 

Without seeing your data I'm having some trouble understanding if you want a single value for the calculation, or if you are trying to work out percentages for many rows of data?

 

Going with just a single calculation, you can try 

 

Percentage = DIVIDE( SUM(adherence[exceptiondurationsecs]), SUM(adherence[adherenceschedulesecs]) )

 

 

If you are certain that will result in a number less than 1 then it's easy to do this

 

Percentage = 1 - DIVIDE( SUM(adherence[exceptiondurationsecs]), SUM(adherence[adherenceschedulesecs]) )

 

 

which will give you a value between 0 and 1.  You can then format that value as a % by clicking on the measure under the Fields and then from the menu click on % or select Percentage from the drop down in the Formatting section

pecr.png

 

regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

2 REPLIES 2
Auski
Helper I
Helper I

Thank you so much @PhilipTreacy, that worked perfectly. I combined your DAX statement with an IF statement to give me the exact output needed.

Legend!

PhilipTreacy
Super User
Super User

Hi @Auski 

 

Without seeing your data I'm having some trouble understanding if you want a single value for the calculation, or if you are trying to work out percentages for many rows of data?

 

Going with just a single calculation, you can try 

 

Percentage = DIVIDE( SUM(adherence[exceptiondurationsecs]), SUM(adherence[adherenceschedulesecs]) )

 

 

If you are certain that will result in a number less than 1 then it's easy to do this

 

Percentage = 1 - DIVIDE( SUM(adherence[exceptiondurationsecs]), SUM(adherence[adherenceschedulesecs]) )

 

 

which will give you a value between 0 and 1.  You can then format that value as a % by clicking on the measure under the Fields and then from the menu click on % or select Percentage from the drop down in the Formatting section

pecr.png

 

regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.