问题
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