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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.