cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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 😬

I have created 2 measures In Power BI:

The DIVIDE calculation will need to be subtracted from 100%. Hope that makes sense

Thanks!

1 ACCEPTED SOLUTION
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

regards

Phil

If I helped you, click on the Thumbs Up to give Kudos.

Proud to be a Super User!

2 REPLIES 2
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!

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

regards

Phil

If I helped you, click on the Thumbs Up to give Kudos.

Proud to be a Super User!

Announcements

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.