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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Anonymous
Not applicable

SUMX Function not working calculating per row

Hi PowerBI Experts. I'm working on a POC project.

Sumx Function is not working as expected I might be missing some calculations.

 

Table1: timesheetCC table

It contains the actual hours, date, Resource ID, Rate,Project ID,

CrisMeer_1-1674637108342.png

I was able to get the correct hours and correct rates per resourceID in the cross table

 

CrisMeer_3-1674637605174.png

Expected result:

Project 125,028.29
  Resource15363.1
  Resource21870
  Resource35711.55
  Resource49683.88
  Resource52399.76
  Resource62622

on the project level I'm getting wrong result but on resource level or row level the calculation is correct

Current result:

CrisMeer_5-1674637743224.png

 

Here's the actual cost formula

Actual Cost = SUMX('Timesheet CC',[Actual Hrs])*MAX('Timesheet CC'[Rate])
 
I am using a calendar table with calendar auto as date dimension connected to the date from timesheetCC. Not sure if this has impacts.
 
Thanks!
 
 

 

 

 

 

 

 

 

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @Anonymous ,

 

When you pick up the MAX at the Actual Cost in the project level you are getting the maximum value for all the lines in that project in this case try to change your measure to:

Actual Cost = SUMX(ADDCOLUMNS('Timesheet CC',"ActualCost",[Actual Hrs])*MAX('Timesheet CC'[Rate])), [ActualCost])

 

 

Just did this without testing it may need some adjustments.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

4 REPLIES 4
Anonymous
Not applicable

I was not able to make it work but probably I'm just not sure how to adjust it as I'm getting error 

CrisMeer_0-1674639826581.png

 

but I found another solution here

 

Solved: Problem with multiplying hours per pay rate - Microsoft Power BI Community

 

Pay Measure 1 = SUM( 'Hours'[Hours] ) * SUM ( 'PAY RATES'[Hrly Rate] )
Pay Measure 2 = 
IF (
    HASONEVALUE ( Hours[Employee ID] ),
    [Pay Measure 1],
    SUMX ( Hours, [Pay Measure 1] )
)

Sorry,

 

Had an additional separator. Try this

Actual Cost = SUMX(ADDCOLUMNS('Timesheet CC',"ActualCost",[Actual Hrs]*MAX('Timesheet CC'[Rate])), [ActualCost])

Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Anonymous
Not applicable

I tried it also not working same output as my original one.

Red circle is this formula

Actual Cost CC Test = SUMX(ADDCOLUMNS('Timesheet CC',"ActualCost",[Actual Hrs]*MAX('Timesheet CC'[Rate])), [ActualCost])

 

CrisMeer_0-1674649174329.png

Appreciate your help thanks!

MFelix
Super User
Super User

Hi @Anonymous ,

 

When you pick up the MAX at the Actual Cost in the project level you are getting the maximum value for all the lines in that project in this case try to change your measure to:

Actual Cost = SUMX(ADDCOLUMNS('Timesheet CC',"ActualCost",[Actual Hrs])*MAX('Timesheet CC'[Rate])), [ActualCost])

 

 

Just did this without testing it may need some adjustments.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.