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
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

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

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
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.

Top Solution Authors