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
HassanAshas
Helper V
Helper V

How to find the total contribution % of each Department towards Total Number?

Hi, I have records of Employees working in different Competencies and Practices. For each employee, I have Billed and Unbilled Hours.

 

The data looks something like this, 

 

Emp_IDEmp_NameCompetencyPracticeBilled HoursUnbilled Hours
25SamData & IntegrationML1105
26EmmaDevelopmentPython7525
27OwenData & IntegrationData Engineering9530
28IsabellaDesignUI/UX2570
29LiamData & IntegrationETL8540
30NoraDevelopmentJava0125
31WilliamData & IntegrationBI4560
32AvaDevelopment.NET0100
33ElijahDesignInteraction Design3550
34SophiaData & IntegrationCloud5535
35LucasDevelopmentJavaScript0120
36OliviaDesignVisual Design1585
37NoahData & IntegrationML12515
38GraceDevelopmentRuby0110
39HenryDesignUsability Testing595
40MiaData & IntegrationETL6545
41AidenDevelopmentC++0130
42EllaDesignUI/UX3060
43JacobData & IntegrationBI8020
44ChloeDevelopmentPython0

130

 

My aim is to find Unbilled Hours Ratio. Formula of Unbilled Hours Ratio is, 

 

 

Unbilled Hours Ratio = Unbilled Hours / (Billed Hours + Unbilled Hours)

 

 

This, I have already implemented using following DAX, 

 

 

Unbilled Hours Ratio = 

var _UnbilledHours = SUM(Employees[Unbilled Hours])
var _BilledHours = SUM(Employees[Billed Hours])
var _TotalHours = _UnbilledHours + _BilledHours

var _Result = 
    DIVIDE(
        _UnbilledHours, 
        _TotalHours
    )
return _Result

 

 

This is giving me the value of 61.5%. 

Now, I want a Bar Chart that shows % values each "Competency" and each "Practice" is contributing towards this 61.5%. 

For now, I have the following visual, 

 

HassanAshas_0-1692363925017.png

 

This basically shows me the Unbilled Hours Ratio for each Competency. I don't want that, I want to find the percentage value each Competency contributed towards the 61.5%. 

The similar will be done for Practices as well (so if I drill down to all the Practices for one Competency, it will show me the % values each Practice contributed towards the total % percentage value of the Competency Unbilled Hours Ratio) 

 

Can anyone help in creating a DAX for this scenario? 

 

If you would like to download the Sample Power BI File, you may do so from here: https://drive.google.com/file/d/1CM918As9DGGt3daOtHaGpYYVkc8IjmZi/view?usp=sharing

1 ACCEPTED SOLUTION
v-yueyunzh-msft
Community Support
Community Support

Hi , @HassanAshas 

Thanks for your sample test .pbix first !And accoridng to your description, you want to " find the percentage value each Competency contributed towards the 61.5%. ".

 

In my understanding, if you want to obtain the corresponding Competency's contribution to 61.5%, then I think you only need to consider the percentage of the Unbilled column, not the Billed column.

vyueyunzhmsft_0-1692585494460.png

 

Here are the steps you can refer to :
We can create this measure :

Measure = var _sub_total =  CALCULATE( SUM('Employees'[Unbilled Hours]) , ALLSELECTED('Employees'[Practice]))
var _total  = CALCULATE( SUM('Employees'[Unbilled Hours]) , ALLSELECTED('Employees'[Competency]))
return
DIVIDE( SUM('Employees'[Unbilled Hours]) ,  IF( ISINSCOPE('Employees'[Practice]) , _sub_total , _total) )

 

Then we can put it on the bar chart and the result is as follows:

vyueyunzhmsft_1-1692585564949.png

 

 

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

View solution in original post

2 REPLIES 2
v-yueyunzh-msft
Community Support
Community Support

Hi , @HassanAshas 

Thanks for your sample test .pbix first !And accoridng to your description, you want to " find the percentage value each Competency contributed towards the 61.5%. ".

 

In my understanding, if you want to obtain the corresponding Competency's contribution to 61.5%, then I think you only need to consider the percentage of the Unbilled column, not the Billed column.

vyueyunzhmsft_0-1692585494460.png

 

Here are the steps you can refer to :
We can create this measure :

Measure = var _sub_total =  CALCULATE( SUM('Employees'[Unbilled Hours]) , ALLSELECTED('Employees'[Practice]))
var _total  = CALCULATE( SUM('Employees'[Unbilled Hours]) , ALLSELECTED('Employees'[Competency]))
return
DIVIDE( SUM('Employees'[Unbilled Hours]) ,  IF( ISINSCOPE('Employees'[Practice]) , _sub_total , _total) )

 

Then we can put it on the bar chart and the result is as follows:

vyueyunzhmsft_1-1692585564949.png

 

 

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

That was amazingly helpful. Thank you so much for giving your precious time for this!!

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.