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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
PowerBIUserUKB
New Member

Unable to calculate % of row

Hello,

I'm trying to calculate the percentage value of one column compared to another one.
Here is a table that will illustrate my challenge.

 

PowerBIUserUKB_0-1606478569197.png

 

When II try to achieve this in Power BI I obtain the following:

 

PowerBIUserUKB_1-1606478606067.png

 

I've tried to understand if any filters could be affecting the result but I just cannot get my head around this.

All measures come from the same table.

 

onlyMet = SUMX(FILTER(sla,sla[SLA_MetNumber]=1),sla[SLA_MetNumber])
onlyNotMet = COUNTX(FILTER(sla,sla[SLA_MetNumber]=0),sla[SLA_MetNumber])
onlyTotal = [onlyMet] + [onlyNotMet]
Percent_SLA = CALCULATE([onlyMet] /[onlyTotal])
 
I'm pretty sure I'm missing something fundamental but cannot see it.
Any help would be much appreciated!
 

 

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@PowerBIUserUKB , Prefer using divide

like

Percent_SLA = divide([onlyMet] ,[onlyTotal])

 

Make it decimal with 2 decimal place and Mark as % column (in measure tool)

 

Data Format New Rib.png

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

Thank you very much for the prompt reply; it solved my problem!

So the lack of decimal places rounded up all results to 1?

Is that all that I was missing?

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@PowerBIUserUKB , Prefer using divide

like

Percent_SLA = divide([onlyMet] ,[onlyTotal])

 

Make it decimal with 2 decimal place and Mark as % column (in measure tool)

 

Data Format New Rib.png

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Thank you very much for the prompt reply; it solved my problem!

So the lack of decimal places rounded up all results to 1?

Is that all that I was missing?

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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