cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
Get the free JMP Student Edition for qualified students and instructors at degree granting institutions.
Choose Language Hide Translation Bar
View Original Published Thread

How to apply a column formula on only a range of rows and not every row?

AC_AC
Level I

Hi,

 

I am trying to create a column formula that calculates the mean of every 5 rows (for a specific column). 

Normally the formula are applied to every row using values in such row. Instead, I would like to use values from 5 previous row to calculate a mean value.

I am been playing with the formula editor and try to use the Row() and other functions, but without success. 

 

Thanks a lot to anyone who can help me out.

 

BR

AC_AC

 

Mean5RowProblem.png

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User


Re: How to apply a column formula on only a range of rows and not every row?

For Mean I would suggest using Col Moving Average

If(Modulo(Row(), 3) == 0,
	Col Moving Average(:Col, 1, 2, 0),
	.
)

jthi_0-1657882865907.png

Otherwise Data table subscripting might be helpful

If(Modulo(Row(), 3) == 0,
	Mean(:Col[Index(Row() - 2, Row())])
)
-Jarmo

View solution in original post

1 REPLY 1
jthi
Super User


Re: How to apply a column formula on only a range of rows and not every row?

For Mean I would suggest using Col Moving Average

If(Modulo(Row(), 3) == 0,
	Col Moving Average(:Col, 1, 2, 0),
	.
)

jthi_0-1657882865907.png

Otherwise Data table subscripting might be helpful

If(Modulo(Row(), 3) == 0,
	Mean(:Col[Index(Row() - 2, Row())])
)
-Jarmo