NightLearner
NightLearner

Reputation: 305

Calculated Column for Adjacent Cells of a Specific Value in Spotfire

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

enter image description here

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

Upvotes: 1

Views: 370

Answers (1)

S3S
S3S

Reputation: 25112

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)

Upvotes: 2

Related Questions