calculate the difference for same column in Spotfire

拟墨画扇 提交于 2019-12-12 22:23:23

问题


I am a beginner for Spotfire. I have a problem about the difference calculation for the some column value.

I have opened a similar question for the date difference calculation, see:calculate the time difference for same column in Spotfire

how can i calculate the difference for the same column, is there any related function like DateDiff() here? for example:

id  times state
 1  12    1
 2   7    0
 3  10    1
 4  11    0
 5   6    1
 6   9    0
 7   7    1

the result could be :

id  times state  diffence
 3  10    1      -2
 5   6    1      -4
 7   7    1       1

For example : for the first difference: -2 = 10 (the third row, the state is 1) - 12(the first row, the state is 1)

thanks for your help :)


回答1:


@ZAWD - Please try this over expression.

If([state]=1,[times] - Sum([times]) over (previous([id])),null)



来源:https://stackoverflow.com/questions/39304042/calculate-the-difference-for-same-column-in-spotfire

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!