Forum Discussion
DiePic
2 years agoResolver II
SUM a measure
Hi all, I've this measure (last column) and this is the code of the measure: Tempo_Risposta_Concordato_Count = // VAR ReplyTime = VALUE(SELECTEDVALUE(Ticket_Data[TktTempoAccettaz...
- 2 years ago
If can be useful for someone, this is my solution:
SUMX( VALUES('table'[id]) ,[MyMeasure])
DiePic
2 years agoResolver II
If can be useful for someone, this is my solution:
SUMX( VALUES('table'[id]) ,[MyMeasure])
- Greg_Deckler2 years agoCommunity Champion
DiePic Yep, you got it, would be the equivalent of this using a more generalized method (below). Also, you might consider using DISTINCT instead of VALUES. VALUES has a nasty habit of returning a blank row when you have unmatched keys in a relationship.
SUMX( SUMMARIZE('table', [id], "__MyMeasure", [MyMeasure]), [MyMeasure] )The advantage of this generalized approach is that one, SUMMARIZE tends to be crazy fast. Two, if you need to "group" by more than one thing, SUMMARIZE can do this while just using DISTINCT or VALUES cannot.