<?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 Conditional aggregation of a single measurement in Visual Analytics(3.5) in SAS Visual Analytics</title>
    <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Conditional-aggregation-of-a-single-measurement-in-Visual/m-p/771411#M15371</link>
    <description>&lt;P&gt;Hi!&lt;BR /&gt;&lt;BR /&gt;I'm working on a Visual Analytics report that utilize the&amp;nbsp;Suppress function when calculating different measurements (If there is less than 5 observations then suppress). The end user of the report now wants to add an additional level on this logic since suppression is only required for a specific category of observations, simply put,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;IF Type=B and number of observations &amp;lt; 5 then Suppress ELSE "calculate measurement".&amp;nbsp;&lt;/EM&gt;I've been prying at this for weeks but haven't manage to get it to work thus I wonder,&lt;STRONG&gt; is this logic possible?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Below is a simplified example&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Let's establish some sample data:&lt;/U&gt;&lt;/P&gt;
&lt;TABLE border="1" width="99.91204925241865%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="42.480211081794195%"&gt;Type&lt;/TD&gt;
&lt;TD width="57.43183817062445%"&gt;Observation&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="42.480211081794195%"&gt;A&lt;/TD&gt;
&lt;TD width="57.43183817062445%"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="42.480211081794195%"&gt;A&lt;/TD&gt;
&lt;TD width="57.43183817062445%"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="42.480211081794195%"&gt;A&lt;/TD&gt;
&lt;TD width="57.43183817062445%"&gt;3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="42.480211081794195%"&gt;B&lt;/TD&gt;
&lt;TD width="57.43183817062445%"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="42.480211081794195%"&gt;B&lt;/TD&gt;
&lt;TD width="57.43183817062445%"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Imagine that I want to create a conditional Sum calculation of &lt;EM&gt;Observation&lt;/EM&gt; that is always allowed to be shown when &lt;EM&gt;Type&lt;/EM&gt;="A" but can't be shown when &lt;EM&gt;Type&lt;/EM&gt;="B" In this case the desired result would be:&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;Type&lt;/TD&gt;
&lt;TD width="50%"&gt;Conditional Sum&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;A&lt;/TD&gt;
&lt;TD&gt;6&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;B&lt;/TD&gt;
&lt;TD width="50%"&gt;*&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Suppression is an aggregated measurement so lets simplify the problem:&lt;/U&gt; &lt;BR /&gt;Is it possible in Visual Analytics to create a measurement that is the Sum of &lt;EM&gt;Observation&lt;/EM&gt; when &lt;EM&gt;Type&lt;/EM&gt;="A" and average of &lt;EM&gt;Observation&lt;/EM&gt; when &lt;EM&gt;Type&lt;/EM&gt;="B"?&lt;BR /&gt;&lt;BR /&gt;I've tried to express this in Visual Analytics as such:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Winter_0-1633015917843.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/64256i756A057D3955677E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Winter_0-1633015917843.png" alt="Winter_0-1633015917843.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;However, when I use this calculated measurement in a table I get the following result:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Winter_1-1633016116462.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/64257i7A7A9C9DAE4583C6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Winter_1-1633016116462.png" alt="Winter_1-1633016116462.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;In fact, whenever I try to use IF/ELSE logic in combination with a aggregated calculations it always results in the ELSE condition.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Conclusion&lt;/U&gt;&amp;nbsp;&lt;BR /&gt;I understand that the IF logic expressed above &lt;U&gt;evaluates each row in the data&lt;/U&gt; while the &lt;U&gt;Sum and Avg is performed "by each group"&lt;/U&gt; and thus it's kind of doing two very different things.&lt;BR /&gt;I'm guessing what I'm looking for is something in the line of "IF current _ByGroup_ (Type) = "A" RETURN ..... ELSE ....." however I haven't found any operators that does that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;While the problem sounds simple, at this point I'm prepared to call it impossible due to how _ByGroups_ works but I'm hoping that I might be wrong &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards and thanks in advance for any suggestions!&lt;/P&gt;
&lt;P&gt;//Winter&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 30 Sep 2021 16:07:03 GMT</pubDate>
    <dc:creator>Winter</dc:creator>
    <dc:date>2021-09-30T16:07:03Z</dc:date>
    <item>
      <title>Conditional aggregation of a single measurement in Visual Analytics(3.5)</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Conditional-aggregation-of-a-single-measurement-in-Visual/m-p/771411#M15371</link>
      <description>&lt;P&gt;Hi!&lt;BR /&gt;&lt;BR /&gt;I'm working on a Visual Analytics report that utilize the&amp;nbsp;Suppress function when calculating different measurements (If there is less than 5 observations then suppress). The end user of the report now wants to add an additional level on this logic since suppression is only required for a specific category of observations, simply put,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;IF Type=B and number of observations &amp;lt; 5 then Suppress ELSE "calculate measurement".&amp;nbsp;&lt;/EM&gt;I've been prying at this for weeks but haven't manage to get it to work thus I wonder,&lt;STRONG&gt; is this logic possible?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Below is a simplified example&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Let's establish some sample data:&lt;/U&gt;&lt;/P&gt;
&lt;TABLE border="1" width="99.91204925241865%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="42.480211081794195%"&gt;Type&lt;/TD&gt;
&lt;TD width="57.43183817062445%"&gt;Observation&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="42.480211081794195%"&gt;A&lt;/TD&gt;
&lt;TD width="57.43183817062445%"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="42.480211081794195%"&gt;A&lt;/TD&gt;
&lt;TD width="57.43183817062445%"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="42.480211081794195%"&gt;A&lt;/TD&gt;
&lt;TD width="57.43183817062445%"&gt;3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="42.480211081794195%"&gt;B&lt;/TD&gt;
&lt;TD width="57.43183817062445%"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="42.480211081794195%"&gt;B&lt;/TD&gt;
&lt;TD width="57.43183817062445%"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Imagine that I want to create a conditional Sum calculation of &lt;EM&gt;Observation&lt;/EM&gt; that is always allowed to be shown when &lt;EM&gt;Type&lt;/EM&gt;="A" but can't be shown when &lt;EM&gt;Type&lt;/EM&gt;="B" In this case the desired result would be:&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;Type&lt;/TD&gt;
&lt;TD width="50%"&gt;Conditional Sum&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;A&lt;/TD&gt;
&lt;TD&gt;6&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;B&lt;/TD&gt;
&lt;TD width="50%"&gt;*&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Suppression is an aggregated measurement so lets simplify the problem:&lt;/U&gt; &lt;BR /&gt;Is it possible in Visual Analytics to create a measurement that is the Sum of &lt;EM&gt;Observation&lt;/EM&gt; when &lt;EM&gt;Type&lt;/EM&gt;="A" and average of &lt;EM&gt;Observation&lt;/EM&gt; when &lt;EM&gt;Type&lt;/EM&gt;="B"?&lt;BR /&gt;&lt;BR /&gt;I've tried to express this in Visual Analytics as such:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Winter_0-1633015917843.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/64256i756A057D3955677E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Winter_0-1633015917843.png" alt="Winter_0-1633015917843.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;However, when I use this calculated measurement in a table I get the following result:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Winter_1-1633016116462.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/64257i7A7A9C9DAE4583C6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Winter_1-1633016116462.png" alt="Winter_1-1633016116462.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;In fact, whenever I try to use IF/ELSE logic in combination with a aggregated calculations it always results in the ELSE condition.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Conclusion&lt;/U&gt;&amp;nbsp;&lt;BR /&gt;I understand that the IF logic expressed above &lt;U&gt;evaluates each row in the data&lt;/U&gt; while the &lt;U&gt;Sum and Avg is performed "by each group"&lt;/U&gt; and thus it's kind of doing two very different things.&lt;BR /&gt;I'm guessing what I'm looking for is something in the line of "IF current _ByGroup_ (Type) = "A" RETURN ..... ELSE ....." however I haven't found any operators that does that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;While the problem sounds simple, at this point I'm prepared to call it impossible due to how _ByGroups_ works but I'm hoping that I might be wrong &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards and thanks in advance for any suggestions!&lt;/P&gt;
&lt;P&gt;//Winter&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Sep 2021 16:07:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Conditional-aggregation-of-a-single-measurement-in-Visual/m-p/771411#M15371</guid>
      <dc:creator>Winter</dc:creator>
      <dc:date>2021-09-30T16:07:03Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional aggregation of a single measurement in Visual Analytics(3.5)</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Conditional-aggregation-of-a-single-measurement-in-Visual/m-p/771511#M15372</link>
      <description>Probably you can achieve this by creating an aggregated table from the original one.&lt;BR /&gt;So you carry both aggregated measures, sum and average and its groupby variable to the newly aggregated table.&lt;BR /&gt;There you can apply your if-then logic but instead of using the dynamic aggregated measures you take their static copy.&lt;BR /&gt;It's static in the context of the aggregated measure but the aggregated table updates as well and reacts to parameters and filters.&lt;BR /&gt;Give it a try</description>
      <pubDate>Thu, 30 Sep 2021 22:35:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Conditional-aggregation-of-a-single-measurement-in-Visual/m-p/771511#M15372</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2021-09-30T22:35:04Z</dc:date>
    </item>
  </channel>
</rss>

