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
Anonymous
Not applicable

Sum of visible row values by separate column

I'm trying to do a basic sum calculation on a basic table and use it as conditional formatting. I need to sum the hours that each employee works across multiple projects (see table). I am using the below formula, but getting incorrect results - not all employees are highlighted - Both the 35 hours and 10 hour cell should be highlighted for john:

 

 

calculate(sum('Project'[Hours]),ALLEXCEPT('Project','Project'[Project_Name],'Project'[Employee]))

 

 

Project_NameEmployeeHours
LawnJohn35
FactoryJohn10
FactoryMike40
11 REPLIES 11
V-lianl-msft
Community Support
Community Support

Hi @Anonymous ,

 

Can you take a screenshot of the relationship between the two tables and the fields in the tables?

 

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

az38
Community Champion
Community Champion

@Anonymous 

try if I understand you correct

calculate(sum('Project'[Hours]),ALLEXCEPT('Project','Project'[Employee]))

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Anonymous
Not applicable

@az38thank you for the reply

 

that is the calculation that i've been trying to use, but it does not sum the values. It returns the row by row hours (i.e., 35, 10,40)

az38
Community Champion
Community Champion

@Anonymous 

so, whats your desired output based on your data sample?


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Anonymous
Not applicable

@az38 

Project_NameEmployeeHoursSUM OF HOURS
LawnJohn3545
FactoryJohn1045
FactoryMike4040
az38
Community Champion
Community Champion

@Anonymous 

did you try my previous suggest

= calculate(sum('Project'[Hours]), ALLEXCEPT('Project','Project'[Employee]))

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Anonymous
Not applicable

@az38yes, but it returned 

Project_NameEmployeeHoursSUM OF HOURS
LawnJohn3535
FactoryJohn1010
FactoryMike4040
az38
Community Champion
Community Champion

@Anonymous 

I think you are doing something wrong

 

Снимок.PNG

pay attention I remove

'Project'[Project_Name],

from your statement


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Anonymous
Not applicable

@az38 - thank you - My table has columns from other database tables as well - do you think that is preventing it from working?

az38
Community Champion
Community Champion

@Anonymous 

I think, no, we drop all filters from context besides employee

do you create a measure in the same Project table?


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Anonymous
Not applicable

the measure is in the project table - but the employee is in a different table

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.