Forum Discussion
Anonymous
5 years agoNot applicable
Weighted average using measures?
I have this data: I am trying to get a weighted average, per LL. That shall be the sum of: TotalPerCustomer * MDMCustomer / Total. (The code for MDMCustomer is [TotalPerCustomer]/...
Fowmy
5 years agoSuper User
Anonymous
You can create the following measure to calculate the weighted average:
M =
var __t =
CALCULATETABLE( SUMMARIZE(Table3,Table3[LL],Table3[CUST], "Total", MAX(Table3[Total Per Customer]),"MDS", MAX(Table3[MDS Customer])), ALLEXCEPT(Table3,Table3[LL] ))
var __Total = SUMX( __t , [Total] )
var __line = SUMX( __t , [Total] * [MDS] )
return
DIVIDE( __line , __Total )