Forum Discussion

formerlyknownas's avatar
5 years ago
Solved

multiplier effect on summed value

I having trouble figuring out why one of my measured values when summed in a table seems to be a multiplied value of correct value.

 

If you look at the HL_Prod column and see the summed result at the bottom line, you'll see what I mean.  The line level HL_Prod numbers are correct the sum of them is approxmiately three times the amount as the sum shoudld be 138 instead of 418.

 

 

The measure for HL_Prod looks like: 

 

HL_Prod = SUM('results (2)'[ProdQty]) * SUM('results (2)'[HL_UNIT])

 

 

It's baffling for me since line level output of HL_Prod as pictured is correct, but perhaps I have made the measure in such a way that explains this doubling effect?

 

Any insight is greatly appreciated.

  • formerlyknownas , Try like


    HL_Prod = SUMX('results (2)','results (2)'[ProdQty] * 'results (2)'[HL_UNIT])

     

    or using group by of your visual , say city, date etc

    HL_Prod = SUMX(values('results (2)'[Group]),calculate(sum('results (2)'[ProdQty]) * sum('results (2)'[HL_UNIT])))

2 Replies

  • formerlyknownas , Try like


    HL_Prod = SUMX('results (2)','results (2)'[ProdQty] * 'results (2)'[HL_UNIT])

     

    or using group by of your visual , say city, date etc

    HL_Prod = SUMX(values('results (2)'[Group]),calculate(sum('results (2)'[ProdQty]) * sum('results (2)'[HL_UNIT])))

  • Thanks so much!  The SUMX line you suggested solved the issue.  I had used the Quick Measure funcitonality of Power BI to do the multiplication and create the measure as I had shared previsouly.  Do you mind sharing why SUMX approach was the way to go?