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
Larsc
Frequent Visitor

Measure percentage between to collums

Hi

 

I have report where i need to do a percentage from to columns, but I cant get it to work

 

My tables are as below, the Percentage measure is the measure I'm trying to create.

I have used various examples found on the web, but they have not worked and calculated the correct percentage.

Any suggestions?

 

 HoursSick leavePercentage measure
Person A8889%
Person B571526%
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Larsc , Based on what I got, a new measure

divide(Sum(Table[Sick leave]), sum(Table[Hours]))

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@Larsc , Based on what I got, a new measure

divide(Sum(Table[Sick leave]), sum(Table[Hours]))

Hi @amitchandak 

 

Thx for the very fast reply.

The measure you gave, I think I came across that previously. The measure works, but its calculating wrong.

 

I have a few lines. The first column is their work hours, the second their sick leave and the third on the calculated percentage from your measure. 

As you can see, its a bit off in some of the calculations. 51 work hours and 20 sick leaves calculates to 38,46 but it should be 39,22.

Some of them are correct, but some are off.

Larsc_0-1657013195220.png

 

@Larsc ,
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

@amitchandak 

I will see if can get a sample pbix file for you.

 

But, im just thinking a bit here. Wouldent the most correct calculation of the sick leave be SICKLEAVE/(HOURS+SICKLEAVE)*100 ? How would that DAX measure look like?

 

For now, I have a measure that sums the hours and sick leave into a value. I need to add the divide part into that dax, how would that look?

 

SygeprocesRegnet = SUM('Work Filtered by month'[Quantity]) + SUM('Sygdom Filtered by month'[Quantity])

 

EDIT: Ok, I now have a measure looking like this:

 

SygeprocesRegnet = SUM('Sygdom Filtered by month'[Quantity]) / SUM('Work Filtered by month'[Quantity]) + SUM('Sygdom Filtered by month'[Quantity])
 
It does work, but the values are way of, showing values of several thousands percentage
 
EDIT 2:
 
Ok, its working now with this DAX
 
SygeprocesRegnet = DIVIDE (sum(('Sygdom Filtered by month'[Quantity])), SUM('Sygdom Filtered by month'[Quantity]) + SUM('Work Filtered by month'[Quantity]))
 
Now my brain hurts and I want a cup of coffee. 
THx for the guidance, it helped pushed me in the right direction.

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.