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
PoweredOut
Resolver I
Resolver I

Percentage of Grand Total of a category

Hello

 

I would like to create a table matrix that should contain the following Categories.

 

Project Name

Employee Name

Role Name

 

The above categories are all from seperate dimension tables. I am trying to calculate the percenatge of worked hours from the Project Name only. Below Table is the result I would like, but at the moment with this measure I get 100% in a cells except for the Total Column.

When I add the measure "Total Allocated Hours" and change the value to %GT Total Allocated Hours, then it works when filtered to individual Projects, but when I remove the filter, it calculates over the whole table. I would like something similar, but it stays the same within the project category.

 

Assignment % = 
VAR total_Allo_Hours = [Total Allocated Hours]
VAR hours_p_role = Calculate([Total Allocated Hours], ALLSELECTED(Roles[name]))
VAR hours_p_user = Calculate([Total Allocated Hours], ALLSELECTED(Users[Employee]))
VAR hours_p_project = Calculate([Total Allocated Hours], ALLSELECTED(Projectroles[Project_Name]))

Return

If(ISINSCOPE(
    Roles[name]), DIVIDE([Total Allocated Hours], hours_p_role),
    if(ISINSCOPE(
    Users[Employee]), DIVIDE([Total Allocated Hours], hours_p_user),
    if(ISINSCOPE(
    Projects[Project_Name]), DIVIDE(total_Allo_Hours, hours_p_project))))

 

 

  Role 1Role 2Total %
Project NameEmployee   
Pro_1Emp125% 25%
 Emp2 25%25%
 Emp325%25%50%

Any help would be appreciated

1 ACCEPTED SOLUTION
PoweredOut
Resolver I
Resolver I

I have solved it with thanks to Sam McCay https://www.youtube.com/watch?v=rBqff_yINmc

 

 

Assignment % = 
DIVIDE([Total Allocated Hours], Calculate([Total Allocated Hours], ALL(Roles[name]),ALL(Users[Employee])), BLANK()
)

 

View solution in original post

1 REPLY 1
PoweredOut
Resolver I
Resolver I

I have solved it with thanks to Sam McCay https://www.youtube.com/watch?v=rBqff_yINmc

 

 

Assignment % = 
DIVIDE([Total Allocated Hours], Calculate([Total Allocated Hours], ALL(Roles[name]),ALL(Users[Employee])), BLANK()
)

 

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.