<?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: subtract numeric value from month parameter in SAS VA in SAS Visual Analytics</title>
    <link>https://communities.sas.com/t5/SAS-Visual-Analytics/subtract-numeric-value-from-month-parameter-in-SAS-VA/m-p/883670#M17375</link>
    <description>&lt;P&gt;Below formulae is giving error Type mismatch: expected type is Boolean, type of item being applied is numeric.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Period is values like January, February..&lt;/P&gt;&lt;P&gt;TreatAs(_Number_, month('Period'n)) - rolling_month&lt;/P&gt;&lt;P&gt;or&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;TreatAs(_Number_, month('Period'n)) - 30&lt;/P&gt;</description>
    <pubDate>Thu, 06 Jul 2023 05:44:35 GMT</pubDate>
    <dc:creator>SASUserRocks</dc:creator>
    <dc:date>2023-07-06T05:44:35Z</dc:date>
    <item>
      <title>subtract numeric value from month parameter in SAS VA</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/subtract-numeric-value-from-month-parameter-in-SAS-VA/m-p/883419#M17357</link>
      <description>&lt;P&gt;Dear friends, Looking forward for some help in below under SAS VA.&lt;/P&gt;&lt;P&gt;I have Period drop down with values 'January' , 'February' ....&lt;/P&gt;&lt;P&gt;I am keeping storing this value in Month parameter.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have another drop down&amp;nbsp; that can select flag values like 1 , 3 , 6 and 12.&lt;/P&gt;&lt;P&gt;Based on selection of this field, final List table must subtract current period with selected flag value and show the result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Eg, if I select Period as March, and flag as 3 , list must show Jan , Feb and March data,&lt;/P&gt;&lt;P&gt;&amp;nbsp; If i select Period as March and flag as 1 , list must show only March data.&lt;/P&gt;&lt;P&gt;basically it should show periods between selected period and&amp;nbsp; selected period - flag.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kindly let me know if anyone has any idea on this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Based on Period selection and below filter is giving data from selected period to beginning of period.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Month('Month'p) &amp;gt;= Month('Period'n)&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jul 2023 11:16:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/subtract-numeric-value-from-month-parameter-in-SAS-VA/m-p/883419#M17357</guid>
      <dc:creator>SASUserRocks</dc:creator>
      <dc:date>2023-07-04T11:16:29Z</dc:date>
    </item>
    <item>
      <title>subtract numeric value from month parameter</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/subtract-numeric-value-from-month-parameter-in-SAS-VA/m-p/883415#M17361</link>
      <description>&lt;P&gt;Dear friends, Looking forward for some help in below under SAS VA.&lt;/P&gt;&lt;P&gt;I have Period drop down with values 'January' , 'February' ....&lt;/P&gt;&lt;P&gt;I am keeping storing this value in Month parameter.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have another drop down&amp;nbsp; that can select flag values like 1 , 3 , 6 and 12.&lt;/P&gt;&lt;P&gt;Based on selection of this field, final List table must subtract current period with selected flag value and show the result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Eg, if I select Period as March, and flag as 3 , list must show Jan , Feb and March data,&lt;/P&gt;&lt;P&gt;&amp;nbsp; If i select Period as March and flag as 1 , list must show only March data.&lt;/P&gt;&lt;P&gt;basically it should show periods between selected period and&amp;nbsp; selected period - flag.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kindly let me know if anyone has any idea on this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Based on Period selection and below filter is giving data from selected period to beginning of period.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Month('Month'p) &amp;gt;= Month('Period'n)&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jul 2023 10:55:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/subtract-numeric-value-from-month-parameter-in-SAS-VA/m-p/883415#M17361</guid>
      <dc:creator>SASUserRocks</dc:creator>
      <dc:date>2023-07-04T10:55:44Z</dc:date>
    </item>
    <item>
      <title>Re: subtract numeric value from month parameter</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/subtract-numeric-value-from-month-parameter-in-SAS-VA/m-p/883416#M17362</link>
      <description>&lt;P&gt;MODERATOR: Please move this to the SAS Visual Analytics forum.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jul 2023 11:03:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/subtract-numeric-value-from-month-parameter-in-SAS-VA/m-p/883416#M17362</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-07-04T11:03:22Z</dc:date>
    </item>
    <item>
      <title>Re: subtract numeric value from month parameter</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/subtract-numeric-value-from-month-parameter-in-SAS-VA/m-p/883487#M17363</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;MODERATOR: Please move this to the SAS Visual Analytics forum.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Done&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jul 2023 21:04:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/subtract-numeric-value-from-month-parameter-in-SAS-VA/m-p/883487#M17363</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2023-07-04T21:04:58Z</dc:date>
    </item>
    <item>
      <title>Re: subtract numeric value from month parameter in SAS VA</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/subtract-numeric-value-from-month-parameter-in-SAS-VA/m-p/883609#M17371</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't think there is an easy way in VA to take a month value like JAN2023 and subtract months from it accurately for an advanced filter. The challenge is when we cross the boundary between years.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS date values are stored as the number of days since 01JAN1960, so it would be possible to subtract a given number of days from the selected month, like 30, 90, 180, or 365. That is probably the best fit for what you are trying to do.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Something else you might consider would be the &lt;A href="https://go.documentation.sas.com/doc/en/vacdc/v_019/vareportdata/p0dovqqp325peyn1dpijpxxmwj83.htm#p1gst5gr3gc4rpn1bppbvnxbytd0" target="_self"&gt;periodic operators&lt;/A&gt; for a calculated measure, such as CumulativePeriod(). You could use these with IF/ELSE logic to show the current month, current quarter, current year, etc., selectable from a drop-down or button bar control. Or you could present all three of those as separate aggregated measures in the same object.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let us know if that helps. Working with dates can be tricky in Visual Analytics, and there have a number of threads on this community board about the subject.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sam&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jul 2023 17:37:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/subtract-numeric-value-from-month-parameter-in-SAS-VA/m-p/883609#M17371</guid>
      <dc:creator>Sam_SAS</dc:creator>
      <dc:date>2023-07-05T17:37:20Z</dc:date>
    </item>
    <item>
      <title>Re: subtract numeric value from month parameter in SAS VA</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/subtract-numeric-value-from-month-parameter-in-SAS-VA/m-p/883669#M17374</link>
      <description>&lt;P&gt;Thanks a lot for your kind response. I am exactly looking for logic to subtract x days from given period in SAS VA. I have now parameterized rolling flages to return 30 ,90 etc.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2023 05:20:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/subtract-numeric-value-from-month-parameter-in-SAS-VA/m-p/883669#M17374</guid>
      <dc:creator>SASUserRocks</dc:creator>
      <dc:date>2023-07-06T05:20:20Z</dc:date>
    </item>
    <item>
      <title>Re: subtract numeric value from month parameter in SAS VA</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/subtract-numeric-value-from-month-parameter-in-SAS-VA/m-p/883670#M17375</link>
      <description>&lt;P&gt;Below formulae is giving error Type mismatch: expected type is Boolean, type of item being applied is numeric.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Period is values like January, February..&lt;/P&gt;&lt;P&gt;TreatAs(_Number_, month('Period'n)) - rolling_month&lt;/P&gt;&lt;P&gt;or&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;TreatAs(_Number_, month('Period'n)) - 30&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2023 05:44:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/subtract-numeric-value-from-month-parameter-in-SAS-VA/m-p/883670#M17375</guid>
      <dc:creator>SASUserRocks</dc:creator>
      <dc:date>2023-07-06T05:44:35Z</dc:date>
    </item>
    <item>
      <title>Re: subtract numeric value from month parameter in SAS VA</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/subtract-numeric-value-from-month-parameter-in-SAS-VA/m-p/883724#M17378</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you putting the expression into the advanced filter editor, or the calculated item editor?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The expression for a filter needs to return a boolean (true/false) so it would need to be something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;TreatAs(_Number_, month('Period'n)) - rolling_month &amp;gt; 0&amp;nbsp; &amp;nbsp; &amp;nbsp;(or whatever would actually make sense)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There needs to be a comparison operator like &amp;gt;, &amp;lt;, =, or In.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Month() operator requires a date value, so your Period parameter would need to be a date parameter. If you apply a month format to the date, it would still display values like 'January'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In order to subtract days, your Period also will need to be a date. The date value could have a month/year format with values like JAN2023, if that helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;All in all, this is not an easy thing to do in VA.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the Advanced Filter window, under Conditions, you will find these:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="conditions.png" style="width: 982px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/85592iBF9C1E36F25724F3/image-size/large?v=v2&amp;amp;px=999" role="button" title="conditions.png" alt="conditions.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you select 'Last 30 days' it will generate syntax like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;'Date'n &amp;gt;= TreatAs(_Date_, ( TreatAs(_Number_, DatePart(Now())) - 30 ))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use this as a starting point to build an expression. You can substitute your Period parameter for the "DatePart(Now())"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;'Date'n &amp;gt;= TreatAs(_Date_, ( TreatAs(_Number_,&lt;FONT color="#FF00FF"&gt; &lt;STRONG&gt;'Period'p&lt;/STRONG&gt;&lt;/FONT&gt;) - 30 ))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Building on that, you could code some IF/ELSE logic to handle the rolling_month parameter:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;IF 'rolling_month'p = 1&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;RETURN 'Date'n &amp;gt;= TreatAs(_Date_, ( TreatAs(_Number_,&lt;STRONG&gt;&lt;FONT color="#FF00FF"&gt; 'Period'p) - 30&lt;/FONT&gt; &lt;/STRONG&gt;))&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;ELSE IF 'rolling_month'p = 3&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; RETURN 'Date'n &amp;gt;= TreatAs(_Date_, ( TreatAs(_Number_,&lt;STRONG&gt;&lt;FONT color="#FF00FF"&gt; 'Period'p) - 90&lt;/FONT&gt;&lt;/STRONG&gt; ))&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; {and so on}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This should work, it will just take a little time and trial and error to get it working the way that you want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sam&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2023 13:31:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/subtract-numeric-value-from-month-parameter-in-SAS-VA/m-p/883724#M17378</guid>
      <dc:creator>Sam_SAS</dc:creator>
      <dc:date>2023-07-06T13:31:57Z</dc:date>
    </item>
  </channel>
</rss>

