<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to find the mean between rows by a group with missing data in a forward-looking format? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-find-the-mean-between-rows-by-a-group-with-missing-data/m-p/956242#M110116</link>
    <description>&lt;P&gt;&lt;SPAN&gt;I'm running into this issue where I have two sets of datapoints across my timeline. One is collected at every point in the interval "Temperature (Celsius)", the other is collected sporadically "Residual Glucose (g/L)". When placed together in a data table, one of the columns is missing data in the interval. I attached a data table as an example but essentially looks like this:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PruningTheBird9_0-1782827462592.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/108057i113DA8AE0148213F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PruningTheBird9_0-1782827462592.png" alt="PruningTheBird9_0-1782827462592.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;What I need is to get the mean of the "Temperature (Celsius)" column between rows that contain data in the "Residual Glucose (g/L)" column. The caveat is that this has to be forward-looking . E.g. at row 1, the result should just be "32".&amp;nbsp; At row 7, the result should be the mean of everything in [Row 2, Row 7] = "32.1". The results should show in the cells highlighted green.&lt;/P&gt;
&lt;P&gt;I have been doing this by creating a helper column, using sort, and then tabulating but this is very time consuming. I am hoping to get help automating this as I keep adding data to my table. I would appreciate any help and/or guidance!&lt;/P&gt;</description>
    <pubDate>Tue, 30 Jun 2026 13:58:38 GMT</pubDate>
    <dc:creator>PruningTheBird9</dc:creator>
    <dc:date>2026-06-30T13:58:38Z</dc:date>
    <item>
      <title>How to find the mean between rows by a group with missing data in a forward-looking format?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-find-the-mean-between-rows-by-a-group-with-missing-data/m-p/956242#M110116</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I'm running into this issue where I have two sets of datapoints across my timeline. One is collected at every point in the interval "Temperature (Celsius)", the other is collected sporadically "Residual Glucose (g/L)". When placed together in a data table, one of the columns is missing data in the interval. I attached a data table as an example but essentially looks like this:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PruningTheBird9_0-1782827462592.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/108057i113DA8AE0148213F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PruningTheBird9_0-1782827462592.png" alt="PruningTheBird9_0-1782827462592.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;What I need is to get the mean of the "Temperature (Celsius)" column between rows that contain data in the "Residual Glucose (g/L)" column. The caveat is that this has to be forward-looking . E.g. at row 1, the result should just be "32".&amp;nbsp; At row 7, the result should be the mean of everything in [Row 2, Row 7] = "32.1". The results should show in the cells highlighted green.&lt;/P&gt;
&lt;P&gt;I have been doing this by creating a helper column, using sort, and then tabulating but this is very time consuming. I am hoping to get help automating this as I keep adding data to my table. I would appreciate any help and/or guidance!&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jun 2026 13:58:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-find-the-mean-between-rows-by-a-group-with-missing-data/m-p/956242#M110116</guid>
      <dc:creator>PruningTheBird9</dc:creator>
      <dc:date>2026-06-30T13:58:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the mean between rows by a group with missing data in a forward-looking format?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-find-the-mean-between-rows-by-a-group-with-missing-data/m-p/956272#M110118</link>
      <description>&lt;P&gt;If you already have done it manually, you could quite easily create workflow to automate it.&lt;/P&gt;
&lt;P&gt;Here is formula which might do what you are looking for (I suggest breaking it into parts to make it easier to understand)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;
If(!IsMissing(:"Residual Glucose (g/L)"n),
	Col Mean(
		:"Temperature (Celsius)"n,
		Col Cumulative Sum(
			!Is Missing(Lag(:"Residual Glucose (g/L)"n)) &amp;amp; Is Missing(:"Residual Glucose (g/L)"n),
			:Batch ID
		),
		:Batch ID
	)
,
	.
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Jun 2026 15:50:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-find-the-mean-between-rows-by-a-group-with-missing-data/m-p/956272#M110118</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2026-06-30T15:50:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the mean between rows by a group with missing data in a forward-looking format?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-find-the-mean-between-rows-by-a-group-with-missing-data/m-p/956274#M110119</link>
      <description>&lt;P&gt;You can create a new column that adds a grouping column that has different group values for each of the non Residual Gluecose value rows.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1782834531970.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/108071i111289732E310EDC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="txnelson_0-1782834531970.png" alt="txnelson_0-1782834531970.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Here is the formula for the calculation of the group variable&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;As Constant( x = 0 );
If( Is Missing( :"Residual Glucose (g/L)"n ) == 0,
	x
	++);
If( Is Missing( :"Residual Glucose (g/L)"n ) == 1,
	x
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then using Col Mean you can get the means you want&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_1-1782834967329.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/108072iAD257B7C8296CA25/image-size/medium?v=v2&amp;amp;px=400" role="button" title="txnelson_1-1782834967329.png" alt="txnelson_1-1782834967329.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Here is the formula for the group mean calculation&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( Is Missing( :group ) == 0,
	Col Mean( :"Temperature (Celsius)"n, :group )
)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Jun 2026 15:56:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-find-the-mean-between-rows-by-a-group-with-missing-data/m-p/956274#M110119</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2026-06-30T15:56:56Z</dc:date>
    </item>
  </channel>
</rss>

