Search code examples
summaxspotfire

Spotfire - Sum only max value


in Spotfire i need to sum only the max value of every category. For example:

Category Value
A 1
A 2
A 2
B 3
B 4
Sum(Max([Value] over ([Category])))

In this case I expect it to return to me as a result 2+4=6 but give me 14 as if it inserts the calculated max in each row of the category and then adds everything.

How can i do? Thanks


Solution

  • This should work

    Sum(CASE WHEN Rank([Value],"desc",[Category],"ties.method=first")=1 then [Value] end)