Calculated Column for Adjacent Cells of a Specific Value in Spotfire

大城市里の小女人 提交于 2019-12-11 06:26:27

问题


I am wondering if it is possible to create a calculated column that will count how many cells of the same value (and only this value) are successive (i.e., next to each other) so that I can divide it by the total number of cells in that column. Any help or advice would be greatly appreciated as I've been scratching my head over this for a while. This is an update to a previous question I posted (link below)

This new question has the key differences below: (1) I only want to count the number of "Blue" cells that are adjacent to other "Blue" cells (2) I would like to do this for (over) each Site

Previous question is here: Number of Successive Cells of a Same Value in Spotfire


回答1:


You'll need to insert your RowID column again, but after that this formula will work for you. You can test by making SiteB, Depth 1 = Blue so that you have two "Blues" touching that are in different sites.

If(([Color]="Blue") and 
(([Color]=First([Color]) over (Intersect([Site],Next([rid]))))
or
([Color]=First([Color]) over (Intersect([Site],Previous([rid]))))),1,0)


来源:https://stackoverflow.com/questions/38836127/calculated-column-for-adjacent-cells-of-a-specific-value-in-spotfire

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