Forum Discussion

PMnooBI's avatar
PMnooBI
Frequent Visitor
3 years ago
Solved

Incorrect Measure values

 

The measure results are incorrect for certain rows. I don't understand why. Please let me know how I can resolve this. Also the totals are wrong as well.

DAX command =>

Spent = SUMX('BTA Hours', 'BTA Hours'[Hours Billed]*RELATED('BTA Hourly Rate'[Hourly Rate ]))
  • PMnooBI Why not:

    Spent = 
      VAR __Hours = SUM('BTA Hours'[Hours Billed])
      VAR __Rate = RELATED('BTA Hourly Rate'[Hourly Rate ])
      VAR __Result = __Hours * __Rate
    RETURN
      __Result

    At least that way you can troubleshoot and debug it.

  • Hi PMnooBI 

    Apparently these rows are an aggregation of multiple rows of the 'BTA Hours' table. The 185 represents two rows, the 555 represents 3 rows and so. Either these rows are duplicates or you need to include more columns in the table visual to make sure only row level is represented in the visual without any chance of aggregation. 

2 Replies

  • tamerj1's avatar
    tamerj1
    Community Champion

    Hi PMnooBI 

    Apparently these rows are an aggregation of multiple rows of the 'BTA Hours' table. The 185 represents two rows, the 555 represents 3 rows and so. Either these rows are duplicates or you need to include more columns in the table visual to make sure only row level is represented in the visual without any chance of aggregation. 

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    PMnooBI Why not:

    Spent = 
      VAR __Hours = SUM('BTA Hours'[Hours Billed])
      VAR __Rate = RELATED('BTA Hourly Rate'[Hourly Rate ])
      VAR __Result = __Hours * __Rate
    RETURN
      __Result

    At least that way you can troubleshoot and debug it.