With scripting you can create things like this (this is missing some sanity checks)
Names Default To Here(1);
dt = Current Data Table();
dt << New Column("Group", Character, Nominal, Formula(
"Test: " || :Test || " Location: " || :Location
));
Summarize(dt, groups = By(:Group));
dt_temp = New Table("TEMPTABLE",
Add Rows(5), // same as your group size
Compress File When Saved(1),
New Column("Depth",
Numeric,
"Continuous",
Values([0, 20, 40, 60, 80])
),
New Column("CD First",
Numeric,
"Continuous"
),
New Column("CD Second",
Numeric,
"Continuous"
),
New Column("CD diff",
Numeric,
"Continuous"
),
Invisible
);
update_expr = Expr(
Try(
first_group = (lb_first << get selected)[1];
second_group = (lb_second << get selected)[1];
first_cd = dt[dt << Get Rows Where(:Group == first_group), "CD (nm)"];
second_cd = dt[dt << Get Rows Where(:Group == second_group), "CD (nm)"];
dt_temp[0, "CD First"] = first_cd;
dt_temp[0, "CD Second"] = second_cd;
dt_temp[0, "CD Diff"] = Abs(second_cd - first_cd);
,
dt_temp[0, "CD First"] = [., . ,., ., .];
dt_temp[0, "CD Second"] = [., . ,., ., .];
dt_temp[0, "CD Diff"] = [., . ,., ., .];
);
);
nw = New Window("Demo",
H List Box(
Panel Box("Pick First Group",
lb_first = List Box(groups)
),
Panel Box("Pick Second Group",
lb_second = List Box(groups)
),
Data Table Box(dt_temp),
gb = dt_temp << Graph Builder(
Size(525, 454),
Show Control Panel(0),
Variables(X(:CD diff), Y(:Depth)),
Elements(Points(X, Y, Legend(11)), Line(X, Y, Legend(13)))
),
Panel Box("Actions",
Lineup Box(N Col(1),
Button Box("Cancel")
)
)
)
);
lb_first << Set Max Selected(1);
lb_second << Set Max Selected(1);
lb_first << Set Script(update_expr);
lb_second << Set Script(update_expr);
Eval(EvalExpr(
nw << On Close(
Close(dt_temp, no save);
)
));

I think you could also duplicate your table so you can do a self-join with "duplicated" columns, join it to the original table by depth, remove self-joins, create grouping selector, formula for differences and create a plot

And this is easy to automate in JMP.

-Jarmo