<?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: Toggle between sum and average in a VA bar chart in SAS Visual Analytics</title>
    <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Toggle-between-sum-and-average-in-a-VA-bar-chart/m-p/932121#M18087</link>
    <description>&lt;P&gt;I agree with&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/28814"&gt;@HunterT_SAS&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/442367"&gt;@sc5&lt;/a&gt;&amp;nbsp;Create a promoted table (and save to sashdat at the same location) and load into your report.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use in this case the _ch_number variable for customized category.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Send some values to one category and name it 'Sum'.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assign 'Mean' to the other one.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use this customized category in a object like a button.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assign a parameter to it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For your target object create a variable like if parameter='Mean' then mean_variable, else sum_variable.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data casuser.dummy_for_va(promote=yes);
do _num=1 to 100;
_ch_number=put(_num, words100.);
output;
end;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 13 Jun 2024 13:06:20 GMT</pubDate>
    <dc:creator>acordes</dc:creator>
    <dc:date>2024-06-13T13:06:20Z</dc:date>
    <item>
      <title>Toggle between sum and average in a VA bar chart</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Toggle-between-sum-and-average-in-a-VA-bar-chart/m-p/932106#M18085</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a bar chart of y vs x. The aggregation of the y variable is set as sum by default. I know I can change this in the data object, but is there a way to add a drop-down toggle for a report viewer to select whether they want to view the sum or average in a specific bar chart?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I assume we can do this with parameters, but I'm not sure how to set up the calculated field to make this work?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 10:18:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Toggle-between-sum-and-average-in-a-VA-bar-chart/m-p/932106#M18085</guid>
      <dc:creator>sc5</dc:creator>
      <dc:date>2024-06-13T10:18:41Z</dc:date>
    </item>
    <item>
      <title>Re: Toggle between sum and average in a VA bar chart</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Toggle-between-sum-and-average-in-a-VA-bar-chart/m-p/932112#M18086</link>
      <description>&lt;P&gt;This blog I think should help you out:&lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/sgf/2016/04/27/use-parameters-to-pick-your-metric-in-visual-analytics-reports/" target="_blank"&gt;https://blogs.sas.com/content/sgf/2016/04/27/use-parameters-to-pick-your-metric-in-visual-analytics-reports/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;It was written several years ago but the same concepts apply to current&amp;nbsp; versions of Visual Analytics.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;One minor change to it I might recommend is instead of using the same datasource to create the custom category, I would use a completely separate dummy datasource. If you use the same datasource then there is a small risk of accidentally filtering report objects when you did not intend to.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 12:02:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Toggle-between-sum-and-average-in-a-VA-bar-chart/m-p/932112#M18086</guid>
      <dc:creator>HunterT_SAS</dc:creator>
      <dc:date>2024-06-13T12:02:21Z</dc:date>
    </item>
    <item>
      <title>Re: Toggle between sum and average in a VA bar chart</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Toggle-between-sum-and-average-in-a-VA-bar-chart/m-p/932121#M18087</link>
      <description>&lt;P&gt;I agree with&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/28814"&gt;@HunterT_SAS&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/442367"&gt;@sc5&lt;/a&gt;&amp;nbsp;Create a promoted table (and save to sashdat at the same location) and load into your report.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use in this case the _ch_number variable for customized category.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Send some values to one category and name it 'Sum'.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assign 'Mean' to the other one.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use this customized category in a object like a button.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assign a parameter to it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For your target object create a variable like if parameter='Mean' then mean_variable, else sum_variable.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data casuser.dummy_for_va(promote=yes);
do _num=1 to 100;
_ch_number=put(_num, words100.);
output;
end;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 13 Jun 2024 13:06:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Toggle-between-sum-and-average-in-a-VA-bar-chart/m-p/932121#M18087</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2024-06-13T13:06:20Z</dc:date>
    </item>
    <item>
      <title>Re: Toggle between sum and average in a VA bar chart</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Toggle-between-sum-and-average-in-a-VA-bar-chart/m-p/932305#M18088</link>
      <description>&lt;P&gt;Thank you! I've got that, I just don't understand how to set up the actual y variable to be graphed? If I try creating a calculated field like "If parameter1 = "Average" then return avg(bygroup,yvar) else return sum(bygroup,yvar) it doesn't let me, it just underlines the "if" in red and doesn't let me create the field.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 20:59:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Toggle-between-sum-and-average-in-a-VA-bar-chart/m-p/932305#M18088</guid>
      <dc:creator>sc5</dc:creator>
      <dc:date>2024-06-13T20:59:29Z</dc:date>
    </item>
    <item>
      <title>Re: Toggle between sum and average in a VA bar chart</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Toggle-between-sum-and-average-in-a-VA-bar-chart/m-p/932317#M18089</link>
      <description>&lt;P&gt;What version of Visual Analytics are you using? The calculation you described should be fine but maybe it's just a syntax problem ('IF' vs 'If' for example).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For instance this one is fine for 2024.05:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HunterT_SAS_0-1718313773624.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/97418i89C610FBB4291981/image-size/medium?v=v2&amp;amp;px=400" role="button" title="HunterT_SAS_0-1718313773624.png" alt="HunterT_SAS_0-1718313773624.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;If that's not it, can you share a screenshot of what you have?&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 21:23:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Toggle-between-sum-and-average-in-a-VA-bar-chart/m-p/932317#M18089</guid>
      <dc:creator>HunterT_SAS</dc:creator>
      <dc:date>2024-06-13T21:23:28Z</dc:date>
    </item>
  </channel>
</rss>

