Forum Discussion
Anonymous
5 years agoNot applicable
Weighted Average
Hello, I need to compute a weighted average for the consumer price. Currently, CP YTD is computed as Average(DB(consumer price). However, if I use this formula I receive an arithmetic avera...
- 5 years ago
Try to use the sumx function.
WA = VAR total_ = CALCULATE( [NES YTD], ALL(xxxxx) ) VAR _Table = ADDCOLUMNS( SUMMARIZE( Sales, xxx[Row1],xxx[Row2] ), "nes", [NES YTD], "cp", [CP YTD] ) RETURN SUMX( _Table , [cp] * [nes]/total_ )
Anonymous
5 years agoNot applicable
Thanks for your reply!
I have just some further questions?
- What do you mean with xxx?
In Var total_ do I need to insert the name of the table? - in Var _Table is sales a new or existing table?
- What do Row1 and Row2 refer to?
I really appreciate your help!
V-lianl-msft
5 years agoCommunity Support
It refers to the column name of row labels. If the problem still exists, Please provide some sample data, preferably a pbix after removing sensitive data.