<?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 Re: Select Previous Year in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Select-Previous-Year/m-p/411100#M66059</link>
    <description>&lt;P&gt;I strongly suggest using Date Increment function with tasks like this. Below is an example with two different dates:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
date1 = Date DMY(15,8,2021);
date2 = Date DMY(1,9,2021);
Show(Date Increment(date1, "month", -12, "start")); //Date Increment(date1, "month", -12, "start") = 01Aug2020;
Show(Date Increment(date2, "month", -12, "start")); //Date Increment(date2, "month", -12, "start") = 01Sep2020;
Show(Date Increment(Today(), "month", -12, "start")); &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Here is a version to be used with data table with :date column:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
dt = Current Data Table();
dt &amp;lt;&amp;lt; Select Where(:date &amp;gt;= Date Increment(Today(), "month", -12, "start"));&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 19 Aug 2021 05:43:15 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2021-08-19T05:43:15Z</dc:date>
    <item>
      <title>Select Previous Year</title>
      <link>https://community.jmp.com/t5/Discussions/Select-Previous-Year/m-p/411003#M66053</link>
      <description>&lt;P&gt;I'm in the process of automating some monthly reports, and am having trouble selecting the data I need. Suppose there is a column of dates. I would like a JSL script that selects the previous 12 months of data, based on the current month.&lt;BR /&gt;Example: We are in August 2021. I would like the script to select all dates from August 2020 to present. Next month when it is September I would like it to select September 2020 to present without any input from me.&lt;BR /&gt;How can I do this? Some other applications like Access and PowerBI have a "Select Previous Year" feature in their interface, but I can't find anything similar in JMP.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 19:54:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Select-Previous-Year/m-p/411003#M66053</guid>
      <dc:creator>benc</dc:creator>
      <dc:date>2023-06-09T19:54:57Z</dc:date>
    </item>
    <item>
      <title>Re: Select Previous Year</title>
      <link>https://community.jmp.com/t5/Discussions/Select-Previous-Year/m-p/411037#M66055</link>
      <description>&lt;P&gt;One way to do this is&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = current data table();
dt &amp;lt;&amp;lt; select where(:date &amp;gt;= DateMDY(month(today()),1,year(today())-1);&lt;BR /&gt;dtSub&amp;nbsp;=&amp;nbsp;dt&amp;nbsp;&amp;lt;&amp;lt;&amp;nbsp;subset(selected&amp;nbsp;rows(1),&amp;nbsp;selected&amp;nbsp;columns(0));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Aug 2021 21:34:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Select-Previous-Year/m-p/411037#M66055</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-08-18T21:34:46Z</dc:date>
    </item>
    <item>
      <title>Re: Select Previous Year</title>
      <link>https://community.jmp.com/t5/Discussions/Select-Previous-Year/m-p/411100#M66059</link>
      <description>&lt;P&gt;I strongly suggest using Date Increment function with tasks like this. Below is an example with two different dates:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
date1 = Date DMY(15,8,2021);
date2 = Date DMY(1,9,2021);
Show(Date Increment(date1, "month", -12, "start")); //Date Increment(date1, "month", -12, "start") = 01Aug2020;
Show(Date Increment(date2, "month", -12, "start")); //Date Increment(date2, "month", -12, "start") = 01Sep2020;
Show(Date Increment(Today(), "month", -12, "start")); &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Here is a version to be used with data table with :date column:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
dt = Current Data Table();
dt &amp;lt;&amp;lt; Select Where(:date &amp;gt;= Date Increment(Today(), "month", -12, "start"));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 Aug 2021 05:43:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Select-Previous-Year/m-p/411100#M66059</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2021-08-19T05:43:15Z</dc:date>
    </item>
    <item>
      <title>Re: Select Previous Year</title>
      <link>https://community.jmp.com/t5/Discussions/Select-Previous-Year/m-p/845874#M102048</link>
      <description>&lt;P&gt;Works better than the LearnBot suggestion. Would be nice if the add-in could use replies/answers from the community posts&lt;/P&gt;</description>
      <pubDate>Tue, 04 Mar 2025 17:35:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Select-Previous-Year/m-p/845874#M102048</guid>
      <dc:creator>Luis_HC</dc:creator>
      <dc:date>2025-03-04T17:35:26Z</dc:date>
    </item>
  </channel>
</rss>

