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_ )
V-lianl-msft
5 years agoCommunity Support
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_
)