<?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 Formula  -  Weekly average for the fist three quarters in a year in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Formula-Weekly-average-for-the-fist-three-quarters-in-a-year/m-p/39787#M23282</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data is displayed on a daily basis (mon - sat). &amp;nbsp;I have converted the date to days of week, weeks, months, quarters, years. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Iam trying to get the average weekly value for the time period 1/1/2015 - 10/3/2015. &amp;nbsp;This would be displayed on 10/5/2015 and it would contain the same value for the rest of the year. &amp;nbsp;&lt;/P&gt;&lt;P&gt;So in essence, it is one weekly average value for Q1 - Q3.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think I can do this in a tabulation, however I am looking for a formula on how to do this. &amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated.&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 31 May 2017 00:05:43 GMT</pubDate>
    <dc:creator>mstanko</dc:creator>
    <dc:date>2017-05-31T00:05:43Z</dc:date>
    <item>
      <title>Formula  -  Weekly average for the fist three quarters in a year</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-Weekly-average-for-the-fist-three-quarters-in-a-year/m-p/39787#M23282</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data is displayed on a daily basis (mon - sat). &amp;nbsp;I have converted the date to days of week, weeks, months, quarters, years. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Iam trying to get the average weekly value for the time period 1/1/2015 - 10/3/2015. &amp;nbsp;This would be displayed on 10/5/2015 and it would contain the same value for the rest of the year. &amp;nbsp;&lt;/P&gt;&lt;P&gt;So in essence, it is one weekly average value for Q1 - Q3.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think I can do this in a tabulation, however I am looking for a formula on how to do this. &amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated.&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 00:05:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-Weekly-average-for-the-fist-three-quarters-in-a-year/m-p/39787#M23282</guid>
      <dc:creator>mstanko</dc:creator>
      <dc:date>2017-05-31T00:05:43Z</dc:date>
    </item>
    <item>
      <title>Re: Formula  -  Weekly average for the fist three quarters in a year</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-Weekly-average-for-the-fist-three-quarters-in-a-year/m-p/39788#M23283</link>
      <description>&lt;P&gt;I am sorry, I forgot to mention that, one the new year starts, I would have 0 for value until Q4 comes around and then would repeat the process with new sets of data for that year.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;THank you&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 00:08:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-Weekly-average-for-the-fist-three-quarters-in-a-year/m-p/39788#M23283</guid>
      <dc:creator>mstanko</dc:creator>
      <dc:date>2017-05-31T00:08:16Z</dc:date>
    </item>
    <item>
      <title>Re: Formula  -  Weekly average for the fist three quarters in a year</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-Weekly-average-for-the-fist-three-quarters-in-a-year/m-p/39791#M23286</link>
      <description>&lt;P&gt;Here is a script that I belive will work......I really didn't test it, but I think you will see the concept.&amp;nbsp; The only guess that I made, was the workweek that Oct. 5th is.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Current Data Table();
tYear = :Year;
If( Date MDY( 1, 1, :Year ) &amp;gt;= :date &amp;lt;= Date MDY( 10, 5, :Year ),
	temp = Col Mean( :Value, :Week, :Year ),
	temp = Mean( :Value[dt &amp;lt;&amp;lt; get rows where( :Week == 39 &amp;amp; tYear == :Year )] )
);
temp;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 31 May 2017 03:52:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-Weekly-average-for-the-fist-three-quarters-in-a-year/m-p/39791#M23286</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2017-05-31T03:52:25Z</dc:date>
    </item>
    <item>
      <title>Re: Formula  -  Weekly average for the fist three quarters in a year</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-Weekly-average-for-the-fist-three-quarters-in-a-year/m-p/39821#M23308</link>
      <description>&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;The results were slightly different from what I was looking for (i got each week average vs. average for all the weeks from Q1- Q3), and then I realized that the results produced by the formula is actually exactly what I need.&amp;nbsp; My original question should have been changed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I appreciate your help with this one.&lt;/P&gt;&lt;P&gt;Thank you very much.&lt;/P&gt;&lt;P&gt;You saved me a lot of time&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 18:53:34 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-Weekly-average-for-the-fist-three-quarters-in-a-year/m-p/39821#M23308</guid>
      <dc:creator>mstanko</dc:creator>
      <dc:date>2017-05-31T18:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: Formula  -  Weekly average for the fist three quarters in a year</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-Weekly-average-for-the-fist-three-quarters-in-a-year/m-p/39822#M23309</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am new to Jmp and its language. If you don't mind me asking, would you pleae walk me through the formula you listed.&lt;/P&gt;&lt;P&gt;Formula worked and produced what it needed to produce, but I am trying to understand it in english.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once again, thank you for your help&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 18:56:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-Weekly-average-for-the-fist-three-quarters-in-a-year/m-p/39822#M23309</guid>
      <dc:creator>mstanko</dc:creator>
      <dc:date>2017-05-31T18:56:31Z</dc:date>
    </item>
    <item>
      <title>Re: Formula  -  Weekly average for the fist three quarters in a year</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-Weekly-average-for-the-fist-three-quarters-in-a-year/m-p/39826#M23312</link>
      <description>&lt;P&gt;I suggest that you take each of the functions&amp;nbsp; below, and look them up in the Scripting Index, and study the examples given for each of them&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Help==&amp;gt;Scripting Index&lt;/P&gt;
&lt;P&gt;Here is my explanation of the formula I passed to you&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// Create a pointer to the data table so it can be referenced in the 
// "Get Rows Where" function
dt = Current Data Table();

// The formula is applied to each row of the data table
// setting tYear equal to :Year sets the value of tYear to the 
// Year for the current row.  This is a little trick that allows
// for the "Get Rows Where" function to have something to compare to
tYear = :Year;

// For the current row, check to see if the current rows value of Date
// falls between January 1st and October 5th for the current year
If( Date MDY( 1, 1, :Year ) &amp;gt;= :date &amp;lt;= Date MDY( 10, 5, :Year ),
    // If it is in between those dates then calculate the Mean of
    // the column for Value where all the rows where Week is equal 
    // to the current row's value of week, and where all the rows where
    // Year is equal to the current rows value of year
	temp = Col Mean( :Value, :Week, :Year )
	,
	// If the current row's date isn't between the dates above, then
	// find all of the rows where Week is equal to week 39, and year is 
	// equal to the row;'s current year.  Then find the mean of those values
	temp = Mean( :Value[dt &amp;lt;&amp;lt; get rows where( :Week == 39 &amp;amp; tYear == :Year )] )
);

// The value that JMP returns to a formula is the last value exeuted in the formula
// Therefore, by placing the variable "temp" as the last thing seen, the 
// calculated value of temp is what the formula value is
temp;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 31 May 2017 20:30:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-Weekly-average-for-the-fist-three-quarters-in-a-year/m-p/39826#M23312</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2017-05-31T20:30:38Z</dc:date>
    </item>
    <item>
      <title>Re: Formula  -  Weekly average for the fist three quarters in a year</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-Weekly-average-for-the-fist-three-quarters-in-a-year/m-p/39829#M23315</link>
      <description>Absolutely will do.&lt;BR /&gt;Thank you for all your help</description>
      <pubDate>Wed, 31 May 2017 21:32:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-Weekly-average-for-the-fist-three-quarters-in-a-year/m-p/39829#M23315</guid>
      <dc:creator>mstanko</dc:creator>
      <dc:date>2017-05-31T21:32:05Z</dc:date>
    </item>
  </channel>
</rss>

