<?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: Aggregate chart expression problem in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Aggregate-chart-expression-problem/m-p/353471#M578395</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your help Jagan.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That does work for the table I showed in my original post.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It does not work, however, if you add the Location as a dimension.&amp;nbsp; I was trying to implement Location as a conditional dimension and allow the client to turn it on and off with a button.&amp;nbsp; Instead of this, I have created two seperate tables with different expressions and put them in a Container.&amp;nbsp; Also added a third table to the container to show them the breakdown by Month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Overall, I have given the client more information than they requested, but hopefully they can use it to validate the calculations and use it with confidence.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 16 Mar 2012 00:30:40 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-03-16T00:30:40Z</dc:date>
    <item>
      <title>Aggregate chart expression problem</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregate-chart-expression-problem/m-p/353469#M578393</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am having trouble with aggregation of chart expressions.&amp;nbsp; &lt;/P&gt;&lt;P&gt;My client wants a table that displays Stock Turns by StockItem.&amp;nbsp; The calculation for this is CostOfSales/CostOnHand.&amp;nbsp; It is normally a value between 0 and 1 (eg 0.12).&lt;/P&gt;&lt;P&gt;The data is stored in a StockPeriod table, which gives us those two values for every StockItem, Location and Month.&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;StockPeriod:&lt;/P&gt;&lt;P&gt;LOAD * Inline [&lt;/P&gt;&lt;P&gt;MonthStart,StockItem,Location,CostOfSales,CostOnHand&lt;/P&gt;&lt;P&gt;1/01/2012,Product1,Location1,10,100&lt;/P&gt;&lt;P&gt;1/01/2012,Product1,Location2,12,100&lt;/P&gt;&lt;P&gt;1/01/2012,Product1,Location3,8,120&lt;/P&gt;&lt;P&gt;1/01/2012,Product2,Location1,30,335&lt;/P&gt;&lt;P&gt;1/01/2012,Product2,Location2,61,296&lt;/P&gt;&lt;P&gt;1/01/2012,Product2,Location3,70,301&lt;/P&gt;&lt;P&gt;1/01/2012,Product3,Location1,82,717&lt;/P&gt;&lt;P&gt;1/01/2012,Product3,Location2,22,828&lt;/P&gt;&lt;P&gt;1/01/2012,Product3,Location3,36,513&lt;/P&gt;&lt;P&gt;1/02/2012,Product1,Location1,87,509&lt;/P&gt;&lt;P&gt;1/02/2012,Product1,Location2,26,881&lt;/P&gt;&lt;P&gt;1/02/2012,Product1,Location3,39,895&lt;/P&gt;&lt;P&gt;1/02/2012,Product2,Location1,88,44&lt;/P&gt;&lt;P&gt;1/02/2012,Product2,Location2,12,691&lt;/P&gt;&lt;P&gt;1/02/2012,Product2,Location3,75,991&lt;/P&gt;&lt;P&gt;1/02/2012,Product3,Location1,84,420&lt;/P&gt;&lt;P&gt;1/02/2012,Product3,Location2,97,709&lt;/P&gt;&lt;P&gt;1/02/2012,Product3,Location3,46,465&lt;/P&gt;&lt;P&gt;1/03/2012,Product1,Location1,80,556&lt;/P&gt;&lt;P&gt;1/03/2012,Product1,Location2,68,794&lt;/P&gt;&lt;P&gt;1/03/2012,Product1,Location3,72,536&lt;/P&gt;&lt;P&gt;1/03/2012,Product2,Location1,43,553&lt;/P&gt;&lt;P&gt;1/03/2012,Product2,Location2,4,874&lt;/P&gt;&lt;P&gt;1/03/2012,Product2,Location3,38,93&lt;/P&gt;&lt;P&gt;1/03/2012,Product3,Location1,86,558&lt;/P&gt;&lt;P&gt;1/03/2012,Product3,Location2,80,441&lt;/P&gt;&lt;P&gt;1/03/2012,Product3,Location3,63,990];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When calculating the Stock Turns for a StockItem, the values should be totalled across all Locations, the ratio calculated, then added together for each month.&lt;/P&gt;&lt;P&gt; Given the data above, I can calculate the correct results using a hard-coded Set Analysis expression as follows:&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;Sum({$&amp;lt;MonthStart={'1/01/2012'}&amp;gt;} CostOfSales) / Sum({$&amp;lt;MonthStart={'1/01/2012'}&amp;gt;} CostOnHand)&lt;/P&gt;&lt;P&gt;+&lt;/P&gt;&lt;P&gt;Sum({$&amp;lt;MonthStart={'1/02/2012'}&amp;gt;} CostOfSales) / Sum({$&amp;lt;MonthStart={'1/02/2012'}&amp;gt;} CostOnHand)&lt;/P&gt;&lt;P&gt;+&lt;/P&gt;&lt;P&gt;Sum({$&amp;lt;MonthStart={'1/03/2012'}&amp;gt;} CostOfSales) / Sum({$&amp;lt;MonthStart={'1/03/2012'}&amp;gt;} CostOnHand)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;IMG alt="Stock Turns.jpg" class="jive-image" src="https://community.qlik.com/legacyfs/online/12159_Stock+Turns.jpg" /&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Obviously this will not work for production, but I cannot develop the correct Aggr expression to make it work dynamically.&lt;/P&gt;&lt;P&gt;Any help is very welcome.&amp;nbsp; I will attach my sample app.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Mar 2012 06:06:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregate-chart-expression-problem/m-p/353469#M578393</guid>
      <dc:creator />
      <dc:date>2012-03-15T06:06:52Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregate chart expression problem</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregate-chart-expression-problem/m-p/353470#M578394</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check the attachment for solution, hope it helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The expression used is &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Sum(Aggr(Sum(CostOfSales)/Sum(CostOnHand), MonthStart, StockItem))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jagan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Mar 2012 08:15:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregate-chart-expression-problem/m-p/353470#M578394</guid>
      <dc:creator>jagan</dc:creator>
      <dc:date>2012-03-15T08:15:47Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregate chart expression problem</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregate-chart-expression-problem/m-p/353471#M578395</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your help Jagan.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That does work for the table I showed in my original post.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It does not work, however, if you add the Location as a dimension.&amp;nbsp; I was trying to implement Location as a conditional dimension and allow the client to turn it on and off with a button.&amp;nbsp; Instead of this, I have created two seperate tables with different expressions and put them in a Container.&amp;nbsp; Also added a third table to the container to show them the breakdown by Month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Overall, I have given the client more information than they requested, but hopefully they can use it to validate the calculations and use it with confidence.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Mar 2012 00:30:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregate-chart-expression-problem/m-p/353471#M578395</guid>
      <dc:creator />
      <dc:date>2012-03-16T00:30:40Z</dc:date>
    </item>
  </channel>
</rss>

