Forum Discussion
Anonymous
6 years agoNot applicable
Weighted Averages
Hello everyone, I think I know the answer, which would be a pain, so I'm hoping there is an easier solution. I am trying to find a weighted average for a column but some of the users don't popul...
Anonymous
6 years agoNot applicable
// For all visible customers in the Customers
// dimension table the formula will calculate
// the age-weighted average income using
// only those customers that have supplied
// their age.
// Remember that a BLANK is treated as
// either '' (strings) or 0 (numbers),
// therefore the below is enough to get
// the weighted average.
[Age-Weighted Average Income] =
var __numerator =
SUMX(
Customers,
Customers[Age] * Customers[Income]
)
var __denominator = SUM( Customers[Age] )
var __avg =
DIVIDE( __numerator, __denominator )
return
__avg
And a mirror measure...
[Income-Weighted Average Age] =
var __numerator =
SUMX(
Customers,
Customers[Age] * Customers[Income]
)
var __denominator = SUM( Customers[Income] )
var __avg =
DIVIDE( __numerator, __denominator )
return
__avg
Hope this helps.
Best
D