cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Image to Table JMP extension imports single or batch images as data tables. Useful to extract curves from pictures or convert image data to curve data to use in analyses like Functional Data Explorer. Download and install the extension.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
LauraW
Level I

How do you write a column formula which can group by rows defined by another column?

Hi,

I would like to be able to write column formulae which can perform various column formula functions within groups defined by rows in, for example, a column called 'group'. There are various mentions of the 'group by' button when using gemini, but I cannot find this. 

 

For example, I would like to calculate the first cycle in the below table when the retention first passes 60 % (cycle where retention <= 60 %) for each group, A, B, and C.

 

How can I go about doing this? Thanks for the help :)

 

My JMP version is JMP18 .

 

LauraW_2-1757346064123.png

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: How do you write a column formula which can group by rows defined by another column?

Here are few examples using my example table

 

Column 4:

:C[Col Min(If(:R <= 60, Row(), .), :G)]

If your data is always in order (by Cycle and Retention) and Retention always reaches 60, using :C[] could be unnecessary and you could calculate the row in "reverse" by calculating how many items are above 60, Column 5:

Col Sum(:R > 60, :G) + 1

jthi_1-1757347794849.png

 

Edit: You could also combine Col Min and Col Number

m = Col Sum(:R <= 60, :G);
If(m > 0,
	Col Number(:G, :G) - m + 1;
,
	.
);
-Jarmo

View solution in original post

2 REPLIES 2
mmarchandFSLR
Level VI

Re: How do you write a column formula which can group by rows defined by another column?

Here's what I came up with.

 

g = :Group[Row()];
Min( :Cycle[Where( :Group == g & :Retention <= 60 )] );
jthi
Super User

Re: How do you write a column formula which can group by rows defined by another column?

Here are few examples using my example table

 

Column 4:

:C[Col Min(If(:R <= 60, Row(), .), :G)]

If your data is always in order (by Cycle and Retention) and Retention always reaches 60, using :C[] could be unnecessary and you could calculate the row in "reverse" by calculating how many items are above 60, Column 5:

Col Sum(:R > 60, :G) + 1

jthi_1-1757347794849.png

 

Edit: You could also combine Col Min and Col Number

m = Col Sum(:R <= 60, :G);
If(m > 0,
	Col Number(:G, :G) - m + 1;
,
	.
);
-Jarmo

Recommended Articles