<?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 Creating a data expression to calculate categories' percentage shares of total amount in ArcGIS Dashboards Questions</title>
    <link>https://community.esri.com/t5/arcgis-dashboards-questions/creating-a-data-expression-to-calculate-categories/m-p/1331307#M8501</link>
    <description>&lt;P&gt;My dashboard includes a100% stacked bar chart for revenue categories. The hover text currently displays the dollar amount of each category bar.&lt;/P&gt;&lt;P&gt;The client wants the hover text to instead display each category's percentage of total revenue. It appears that requires a data expression.&lt;/P&gt;&lt;P&gt;So, consulting &lt;A href="https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-calculate-the-percentage-of/m-p/1127965#M5521" target="_self"&gt;this post&lt;/A&gt;, I've set out to create a data expression that defines a variable of total revenue by month and type (actual or forecast), and uses that to generate a percentage for each revenue category.&lt;/P&gt;&lt;P&gt;I'm able to get total revenue by month and type with the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var tot_val= GroupBy( fs,
    ['month_year_x','type'],
     [{
        name:'total_rev',
        expression:'value',
        statistic: 'SUM'}]);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I get an error message when I try to use the above variable in a subsequent section of code to calculate a revenue source's percentage of the total.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;return GroupBy(
    fs,
    ['rev_category','month_year_x','type'],
    [{
        name:'value_pct',
        expression: 'value /tot_val',
        statistic: 'SUM'
      }
      ]);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The resulting serial chart would be categorized on the month_year field and split by the rev_category field. It also would include a filter so that the chart only displays "actual" numbers. Thanks.&lt;/P&gt;</description>
    <pubDate>Fri, 22 Sep 2023 00:04:32 GMT</pubDate>
    <dc:creator>JimMiller3</dc:creator>
    <dc:date>2023-09-22T00:04:32Z</dc:date>
    <item>
      <title>Creating a data expression to calculate categories' percentage shares of total amount</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/creating-a-data-expression-to-calculate-categories/m-p/1331307#M8501</link>
      <description>&lt;P&gt;My dashboard includes a100% stacked bar chart for revenue categories. The hover text currently displays the dollar amount of each category bar.&lt;/P&gt;&lt;P&gt;The client wants the hover text to instead display each category's percentage of total revenue. It appears that requires a data expression.&lt;/P&gt;&lt;P&gt;So, consulting &lt;A href="https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expression-calculate-the-percentage-of/m-p/1127965#M5521" target="_self"&gt;this post&lt;/A&gt;, I've set out to create a data expression that defines a variable of total revenue by month and type (actual or forecast), and uses that to generate a percentage for each revenue category.&lt;/P&gt;&lt;P&gt;I'm able to get total revenue by month and type with the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var tot_val= GroupBy( fs,
    ['month_year_x','type'],
     [{
        name:'total_rev',
        expression:'value',
        statistic: 'SUM'}]);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I get an error message when I try to use the above variable in a subsequent section of code to calculate a revenue source's percentage of the total.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;return GroupBy(
    fs,
    ['rev_category','month_year_x','type'],
    [{
        name:'value_pct',
        expression: 'value /tot_val',
        statistic: 'SUM'
      }
      ]);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The resulting serial chart would be categorized on the month_year field and split by the rev_category field. It also would include a filter so that the chart only displays "actual" numbers. Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Sep 2023 00:04:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/creating-a-data-expression-to-calculate-categories/m-p/1331307#M8501</guid>
      <dc:creator>JimMiller3</dc:creator>
      <dc:date>2023-09-22T00:04:32Z</dc:date>
    </item>
  </channel>
</rss>

