Forum Discussion
itchyeyeballs
9 years agoImpactful Individual
SumX using max
Hi all, I'm having an issue with using SumX and can't figure out what I'm doing wrong (the 'X' functions always trip me up) I'm trying to calculate the sum of the maximum values accross grou...
- 9 years ago
hi, just add a Calculate in Max.
Measure 2 = IF ( HASONEVALUE ( Table1[col2] ), MAX ( Table1[Value] ), SUMX ( VALUES ( Table1[Col2] ), CALCULATE ( MAX ( table1[value] ) ) ) )
Vvelarde
9 years agoCommunity Champion
hi, just add a Calculate in Max.
Measure 2 =
IF (
HASONEVALUE ( Table1[col2] ),
MAX ( Table1[Value] ),
SUMX ( VALUES ( Table1[Col2] ), CALCULATE ( MAX ( table1[value] ) ) )
)itchyeyeballs
9 years agoImpactful Individual
Perfect, thank you!
- OwenAuger9 years agoSuper User
A side note:
You can also get rid of the HASONEVALUE test, since if Col2 has one value then SUMX will iterate over that one value anyway:
= SUMX ( VALUES ( Table1[Col2] ), CALCULATE ( MAX ( table1[value] ) ) )