cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Instantly extract effect sizes, F-ratios, and FDR-adjusted p-values from your models with the Calculate Effects Sizes extension, available now in the JMP Marketplace!
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • Your voice matters! Tell us how you prefer to receive JMP updates, so we can tailor our communication to your needs. Take short survey.

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