Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

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,

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

 

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:

 

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!
 
 

 

 

 

 

 

 

 

  • 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.

4 Replies

  • 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.

    • MFelix's avatar
      MFelix
      Icon for Super User rankSuper User

      Sorry,

       

      Had an additional separator. Try this

      Actual Cost = SUMX(ADDCOLUMNS('Timesheet CC',"ActualCost",[Actual Hrs]*MAX('Timesheet CC'[Rate])), [ActualCost])
      • Anonymous's avatar
        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])

         

        Appreciate your help thanks!