Forum Discussion
Anonymous
4 years agoNot applicable
Using SUMX twice within GROUPBY expression
Unit Category Score Weight Unit A X 5 2 Unit A Y 10 3 Unit A Z 15 2 Unit B X 1 7 Unit B Z 2 9 Unit C W 4 11 Essentially, what I want to do i...
- 4 years ago
Anonymous try this
Measure =
VAR _sum =
SUMX ( tbl, tbl[score] * tbl[weight] )
VAR _count =
CALCULATE ( SUM ( tbl[weight] ), ALLEXCEPT ( tbl, tbl[unit] ) )
RETURN
DIVIDE ( _sum, _count )
wdx223_Daniel
4 years agoCommunity Champion
NewTable=ADDCOLUMNS(VALUES('Table'[Unit]),"@CalCol",CALCULATE(DIVIDE(SUMX('Table','Table'[Score]*'Table'[Weight]),SUM('Table'[Weight]))))