Forum Discussion
Anonymous
4 years agoNot applicable
Weighted average - help needed
Hello everyone, I am learning PowerBI and am trying to calculate an average value. I have the population size for a series of cities, across a number of years, and the population age C...
- 4 years ago
Weighted average can be computed like this:
AvgAge = DIVIDE ( SUMX ( Table1, Table1[Age] * Table1[Size] ), SUMX ( Table1, Table1[Size] ) )
AlexisOlson
4 years agoSuper User
Weighted average can be computed like this:
AvgAge =
DIVIDE (
SUMX ( Table1, Table1[Age] * Table1[Size] ),
SUMX ( Table1, Table1[Size] )
)- Anonymous4 years agoNot applicable
Thank you AlexisOlson !
Would it be the same if I wrote:
AveAge = DIVIDE(SUMX (Table1, Table1[Age] * Table1[Size]), SUM(Table1[Size])) ?
I don't understand why you are using the SUMX within the DIVIDE function....
Thank you!
AvgAge = DIVIDE ( SUMX ( Table1, Table1[Age] * Table1[Size] ), SUMX ( Table1, Table1[Size] ) )- AlexisOlson4 years agoSuper User
Yeah, it should be the same.
I kept the SUMX in the denominator only for aesthetic reasons to emphasize the parallel with the numerator.