<?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: SAS Visual Analytics, Possibility of applying rules by category in SAS Visual Analytics</title>
    <link>https://communities.sas.com/t5/SAS-Visual-Analytics/SAS-Visual-Analytics-Possibility-of-applying-rules-by-category/m-p/934101#M18103</link>
    <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/7050"&gt;@prsr&lt;/a&gt;! I believe you can achieve this by creating a calculated item that flags a 1 or 0 if the aggregated value is higher than the expected value for that specific category. Let's consider this with sashelp.cars: we have a bar chart with average horsepower by origin. If the average horsepower for Asian vehicles is &amp;gt; 150, we want the bar to be red. Let's create a calculation that does this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;if( Avg(ByGroup, if(Origin = 'Asia') return Horsepower else .) ) &amp;gt; 150
    return 1
else 0&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now we can add this calculation as a rule to our bar chart. Based on our calculation, this can only be a 1 or 0 for Asian vehicles.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Stu_SAS_0-1719588422497.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/97988i9E3158154E64E93F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Stu_SAS_0-1719588422497.png" alt="Stu_SAS_0-1719588422497.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And now if we look at our bar chart, only Asia is highlighted red.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Stu_SAS_1-1719588598615.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/97989iE1692193F8108740/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Stu_SAS_1-1719588598615.png" alt="Stu_SAS_1-1719588598615.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 28 Jun 2024 15:31:24 GMT</pubDate>
    <dc:creator>Stu_SAS</dc:creator>
    <dc:date>2024-06-28T15:31:24Z</dc:date>
    <item>
      <title>SAS Visual Analytics, Possibility of applying rules by category</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/SAS-Visual-Analytics-Possibility-of-applying-rules-by-category/m-p/934060#M18101</link>
      <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Pls assist, thanks in advance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am applying colour coding based on the % of status (status has 3 categories in it - Planned, Completed, Overdue). Now the rules are applied as a whole. Is there a way to include colour coding by status.&lt;/P&gt;
&lt;P&gt;current scenario:&lt;/P&gt;
&lt;P&gt;If status:&lt;/P&gt;
&lt;TABLE width="327"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="327"&gt;
&lt;P&gt;95% - 100% green&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="327"&gt;
&lt;P&gt;75% - &amp;lt;95% amber&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="327"&gt;
&lt;P&gt;&amp;lt;75% red&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is it possible to apply rules based on status:&lt;/P&gt;
&lt;P&gt;if status="Completed" and percentage ge 75% then green.&lt;/P&gt;
&lt;P&gt;if status="Overdue" and percentage le 5% then green.&lt;/P&gt;
&lt;P&gt;...and so on.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="prsr_0-1719582471377.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/97970iF7426BB4355D2B0B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="prsr_0-1719582471377.png" alt="prsr_0-1719582471377.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;RP&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2024 13:48:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/SAS-Visual-Analytics-Possibility-of-applying-rules-by-category/m-p/934060#M18101</guid>
      <dc:creator>prsr</dc:creator>
      <dc:date>2024-06-28T13:48:32Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Visual Analytics, Possibility of applying rules by category</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/SAS-Visual-Analytics-Possibility-of-applying-rules-by-category/m-p/934101#M18103</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/7050"&gt;@prsr&lt;/a&gt;! I believe you can achieve this by creating a calculated item that flags a 1 or 0 if the aggregated value is higher than the expected value for that specific category. Let's consider this with sashelp.cars: we have a bar chart with average horsepower by origin. If the average horsepower for Asian vehicles is &amp;gt; 150, we want the bar to be red. Let's create a calculation that does this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;if( Avg(ByGroup, if(Origin = 'Asia') return Horsepower else .) ) &amp;gt; 150
    return 1
else 0&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now we can add this calculation as a rule to our bar chart. Based on our calculation, this can only be a 1 or 0 for Asian vehicles.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Stu_SAS_0-1719588422497.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/97988i9E3158154E64E93F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Stu_SAS_0-1719588422497.png" alt="Stu_SAS_0-1719588422497.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And now if we look at our bar chart, only Asia is highlighted red.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Stu_SAS_1-1719588598615.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/97989iE1692193F8108740/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Stu_SAS_1-1719588598615.png" alt="Stu_SAS_1-1719588598615.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2024 15:31:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/SAS-Visual-Analytics-Possibility-of-applying-rules-by-category/m-p/934101#M18103</guid>
      <dc:creator>Stu_SAS</dc:creator>
      <dc:date>2024-06-28T15:31:24Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Visual Analytics, Possibility of applying rules by category</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/SAS-Visual-Analytics-Possibility-of-applying-rules-by-category/m-p/934190#M18106</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/61362"&gt;@Stu_SAS&lt;/a&gt;, Thanks for your time assisting on this.&lt;/P&gt;
&lt;P&gt;I have the below data structure:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="prsr_0-1719769783306.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/98027i57FC0AB026B3FEC3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="prsr_0-1719769783306.png" alt="prsr_0-1719769783306.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;1 – status , directly from SAS table&lt;/P&gt;
&lt;P&gt;2 – count , directly from SAS table&lt;/P&gt;
&lt;P&gt;3 – % calculated data item – aggregate measure created as below&lt;/P&gt;
&lt;P&gt;Sum [_ByGroup_] ('count'n) / Sum [_ForAll_] ('count'n)&lt;/P&gt;
&lt;P&gt;Format Percentage applied&lt;/P&gt;
&lt;P&gt;4 – % calculated data item as above, but with out percentage format&lt;/P&gt;
&lt;P&gt;In your example, both the fields already in sas table. I tried to replicate the example on on sas sample cars table and it worked. In my case (table structure above), I have to use &lt;STRONG&gt;%&lt;/STRONG&gt; field (&lt;STRONG&gt;calculated data item – Aggregated measure)&lt;/STRONG&gt; in conjunction with &lt;STRONG&gt;status&lt;/STRONG&gt;. &lt;U&gt;Is it possible to use one field that is part of the sas table (…status) and another an aggregate measure (%) together in an expression&lt;/U&gt; to my requirement to colour bar chart – bar (overdue) and % &amp;gt;0.003.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried below expressions using calculated item Aggregate measure %–&lt;/P&gt;
&lt;P&gt;IF ( Sum [_ByGroup_] ((&lt;/P&gt;
&lt;P&gt;IF ( UpCase('Status'n) = 'OVERDUE' )&lt;/P&gt;
&lt;P&gt;RETURN '%'n&lt;/P&gt;
&lt;P&gt;ELSE . )) &amp;gt; 0.001 )&lt;/P&gt;
&lt;P&gt;RETURN 1&lt;/P&gt;
&lt;P&gt;ELSE 0&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(IF ('STATUS'n ='Overdue') return ((sum [_ByGroup_] ('%_num'n)) ELSE .) &amp;gt;0.002 )&lt;/P&gt;
&lt;P&gt;return 1&lt;/P&gt;
&lt;P&gt;else .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;RP&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 30 Jun 2024 17:54:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/SAS-Visual-Analytics-Possibility-of-applying-rules-by-category/m-p/934190#M18106</guid>
      <dc:creator>prsr</dc:creator>
      <dc:date>2024-06-30T17:54:10Z</dc:date>
    </item>
  </channel>
</rss>

