Forum Discussion
DaxBoi
5 years agoNew Member
Conditional SUM
I have a dataset that looks like the following. For each ID there is an Attribute which has a score. There is also a target 0-4 with a weighting. I'm looking to create a visual with a diffe...
amitchandak
5 years agoSuper User
DaxBoi , As measures
new score = sumx(All(Table),[Target]*[Weighting])
or
new score = sumx(Allselected(Table),[Target]*[Weighting])
or
new score = calculate(sumx(Table,[Target]*[Weighting]),All(Table))
or
new score = calculate(sumx(Table,[Target]*[Weighting]),Allselected(Table))
diff = Sum(Table[Score]) -[new score]
As new column
new score = sumx(Table,[Target]*[Weighting]
diff = [Score] -[new score] //Both are column here
DaxBoi
5 years agoNew Member
I think I wasn't clear in my question
The aim is to have a conditional sum that looks like this. The sum would be over the 5 total rows for
ID = 1 Attribute = A1
and then another sum over the rows for
ID = 1 Attribute = A2
and so on.
| ID | Attribute | Score | Target | Sum(T*W) | Diff |
| 1 | A1 | 4 | (0-4) | 2.6 | +1.4 |
| +4 | rows as | above | |||
| 1 | A2 | 3 | (0-4) | 3.5 | -0.5 |
| +4 | rows | ||||
| 1 | A3 | 4 | (0-4) | 1 | +3.0 |