<?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: Show End of Period Values in SAS Visual Analytics</title>
    <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Show-End-of-Period-Values/m-p/781958#M15654</link>
    <description>&lt;P&gt;The quickest approach would be to add a binary flag to your data indicating the end of the month. For example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    flag_end_of_month = (date = intnx('month', date, 0, 'E') );
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can then use this to create a custom category in Visual Analytics that creates your filter. Or, you can name it 'End of Month' directly in the code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Alternatively, you can create this flag directly in Visual Analytics with some more manual logic:&lt;/P&gt;
&lt;PRE&gt;if(   (month('Date'n) in(1,3,5,7,8,10,12)  AND dayofmonth('Date'n) = 31)
   OR (month('Date'n) in(4,6,9,11)         AND dayofmonth('Date'n) = 30)
   OR (month('Date'n) = 2                  AND dayofmonth('Date'n) in(28*(1-'Leap Year'n), 29*'Leap Year'n) )
   )
return 'End of Month'
else ' '&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Where &lt;FONT face="courier new,courier"&gt;'Leap Year'n&lt;/FONT&gt; is:&lt;/P&gt;
&lt;PRE&gt;if(    (mod(year('Date'n), 4)   = 0 AND mod(year('Date'n), 100) &amp;gt; 0)&lt;BR /&gt;    OR (mod(year('Date'n), 400) = 0 AND mod(year('Date'n), 100) = 0)&lt;BR /&gt;  )&lt;BR /&gt;return 1&lt;BR /&gt;else 0&lt;/PRE&gt;
&lt;P&gt;Which we get from the standard leap year formula:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;The year is evenly divisible by 4 and the year is not evenly divisible by 100 or;&lt;/LI&gt;
&lt;LI&gt;The year is evenly divisible by 400 and evenly divisible by 100&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Thank you for posting this question - this is a great use case for expanding date/time functions within Visual Analytics to do these types of calculations.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 24 Nov 2021 13:59:10 GMT</pubDate>
    <dc:creator>Stu_SAS</dc:creator>
    <dc:date>2021-11-24T13:59:10Z</dc:date>
    <item>
      <title>Show End of Period Values</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Show-End-of-Period-Values/m-p/781697#M15650</link>
      <description>&lt;P&gt;Hi VA Users,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to create a cross tab report which will show the End of period values rather than the summing of the values.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The data looks like this&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Category_lvl_1&lt;/TD&gt;&lt;TD&gt;Category_lvl_2&lt;/TD&gt;&lt;TD&gt;LOB&lt;/TD&gt;&lt;TD&gt;Value&lt;/TD&gt;&lt;TD&gt;End_of_Month&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Cat1&lt;/TD&gt;&lt;TD&gt;Sub_cat1&lt;/TD&gt;&lt;TD&gt;LOB1&lt;/TD&gt;&lt;TD&gt;21&lt;/TD&gt;&lt;TD&gt;31-Jan-20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Cat1&lt;/TD&gt;&lt;TD&gt;Sub_cat3&lt;/TD&gt;&lt;TD&gt;LOB1&lt;/TD&gt;&lt;TD&gt;19&lt;/TD&gt;&lt;TD&gt;31-Jan-20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Cat1&lt;/TD&gt;&lt;TD&gt;Sub_cat2&lt;/TD&gt;&lt;TD&gt;LOB2&lt;/TD&gt;&lt;TD&gt;31&lt;/TD&gt;&lt;TD&gt;29-Feb-20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;cat2&lt;/TD&gt;&lt;TD&gt;Sub_cat3&lt;/TD&gt;&lt;TD&gt;LOB1&lt;/TD&gt;&lt;TD&gt;24&lt;/TD&gt;&lt;TD&gt;31-Jan-20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;cat2&lt;/TD&gt;&lt;TD&gt;Sub_cat4&lt;/TD&gt;&lt;TD&gt;LOB2&lt;/TD&gt;&lt;TD&gt;54&lt;/TD&gt;&lt;TD&gt;29-Feb-20&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The page filter will be END_OF_Moth&lt;/P&gt;&lt;P&gt;So the measure column "Value" Should show the values based on the page filter. Like, if the page is not filtered then it should show 29-Feb-20 values. If let's say the page is filtered on&amp;nbsp;"31-Jan-20" then for cat 1 it should show for Cat1/LOB1 cross tab (21+19) = 40.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible to show like this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Suvendu&lt;/P&gt;</description>
      <pubDate>Mon, 22 Nov 2021 12:06:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Show-End-of-Period-Values/m-p/781697#M15650</guid>
      <dc:creator>Suvi2020</dc:creator>
      <dc:date>2021-11-22T12:06:18Z</dc:date>
    </item>
    <item>
      <title>Re: Show End of Period Values</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Show-End-of-Period-Values/m-p/781958#M15654</link>
      <description>&lt;P&gt;The quickest approach would be to add a binary flag to your data indicating the end of the month. For example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    flag_end_of_month = (date = intnx('month', date, 0, 'E') );
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can then use this to create a custom category in Visual Analytics that creates your filter. Or, you can name it 'End of Month' directly in the code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Alternatively, you can create this flag directly in Visual Analytics with some more manual logic:&lt;/P&gt;
&lt;PRE&gt;if(   (month('Date'n) in(1,3,5,7,8,10,12)  AND dayofmonth('Date'n) = 31)
   OR (month('Date'n) in(4,6,9,11)         AND dayofmonth('Date'n) = 30)
   OR (month('Date'n) = 2                  AND dayofmonth('Date'n) in(28*(1-'Leap Year'n), 29*'Leap Year'n) )
   )
return 'End of Month'
else ' '&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Where &lt;FONT face="courier new,courier"&gt;'Leap Year'n&lt;/FONT&gt; is:&lt;/P&gt;
&lt;PRE&gt;if(    (mod(year('Date'n), 4)   = 0 AND mod(year('Date'n), 100) &amp;gt; 0)&lt;BR /&gt;    OR (mod(year('Date'n), 400) = 0 AND mod(year('Date'n), 100) = 0)&lt;BR /&gt;  )&lt;BR /&gt;return 1&lt;BR /&gt;else 0&lt;/PRE&gt;
&lt;P&gt;Which we get from the standard leap year formula:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;The year is evenly divisible by 4 and the year is not evenly divisible by 100 or;&lt;/LI&gt;
&lt;LI&gt;The year is evenly divisible by 400 and evenly divisible by 100&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Thank you for posting this question - this is a great use case for expanding date/time functions within Visual Analytics to do these types of calculations.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Nov 2021 13:59:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Show-End-of-Period-Values/m-p/781958#M15654</guid>
      <dc:creator>Stu_SAS</dc:creator>
      <dc:date>2021-11-24T13:59:10Z</dc:date>
    </item>
  </channel>
</rss>

