<?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 Price variance calculation with aggr and set analysis in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Price-variance-calculation-with-aggr-and-set-analysis/m-p/285924#M499537</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello experts,&lt;/P&gt;&lt;P&gt;I'm struggling with the combination of aggr and set analysis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basicly, I want to implement a Price Variance Calculation, &lt;/P&gt;&lt;P&gt;which should work with the formula "Delta Price * original Qty".&lt;/P&gt;&lt;P&gt;On single lines (per product) it works fine, but the totals, especially if in per cent, are incorrect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="4069" alt="screenshot.PNG" class="jive-image-thumbnail jive-image" height="137" src="https://community.qlik.com/legacyfs/online/4069_screenshot.PNG" width="811" /&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the attached example the column "simplified unit price variance" shows the correct values, but won't work to show correct per centages,&lt;/P&gt;&lt;P&gt;because there I cannot use the sum(values)&amp;nbsp; &lt;IMG /&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My attempt so use aggr was not succesful, the total is 600, but correct would be 100.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas/proposal are highly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;__________________________________________&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;aggr_formula of: "incorrect Unit Price Variance %"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;=&lt;/P&gt;&lt;P&gt;(&lt;/P&gt;&lt;P&gt; sum({$&amp;lt;year={$(=max(year))}&amp;gt;} aggr&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (sum({$&amp;lt;year={$(=max(year))}&amp;gt;} Sales)&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /sum({$&amp;lt;year={$(=max(year))}&amp;gt;} QTY)&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , year, product))&lt;/P&gt;&lt;P&gt;- sum({$&amp;lt;year={$(=max(year)-1)}&amp;gt;} aggr&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (sum({$&amp;lt;year={$(=max(year)-1)}&amp;gt;} Sales)&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /sum({$&amp;lt;year={$(=max(year)-1)}&amp;gt;} QTY)&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , year, product))&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;*sum({$&amp;lt;year={$(=max(year)-1)}&amp;gt;} aggr&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (sum({$&amp;lt;year={$(=max(year)-1)}&amp;gt;} QTY)&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , year, product))&lt;/P&gt;&lt;P&gt;/&lt;/P&gt;&lt;P&gt;sum({$&amp;lt;year={$(=max(year)-1)}&amp;gt;} Sales)&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 10 May 2011 09:13:42 GMT</pubDate>
    <dc:creator />
    <dc:date>2011-05-10T09:13:42Z</dc:date>
    <item>
      <title>Price variance calculation with aggr and set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Price-variance-calculation-with-aggr-and-set-analysis/m-p/285924#M499537</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello experts,&lt;/P&gt;&lt;P&gt;I'm struggling with the combination of aggr and set analysis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basicly, I want to implement a Price Variance Calculation, &lt;/P&gt;&lt;P&gt;which should work with the formula "Delta Price * original Qty".&lt;/P&gt;&lt;P&gt;On single lines (per product) it works fine, but the totals, especially if in per cent, are incorrect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="4069" alt="screenshot.PNG" class="jive-image-thumbnail jive-image" height="137" src="https://community.qlik.com/legacyfs/online/4069_screenshot.PNG" width="811" /&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the attached example the column "simplified unit price variance" shows the correct values, but won't work to show correct per centages,&lt;/P&gt;&lt;P&gt;because there I cannot use the sum(values)&amp;nbsp; &lt;IMG /&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My attempt so use aggr was not succesful, the total is 600, but correct would be 100.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas/proposal are highly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;__________________________________________&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;aggr_formula of: "incorrect Unit Price Variance %"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;=&lt;/P&gt;&lt;P&gt;(&lt;/P&gt;&lt;P&gt; sum({$&amp;lt;year={$(=max(year))}&amp;gt;} aggr&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (sum({$&amp;lt;year={$(=max(year))}&amp;gt;} Sales)&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /sum({$&amp;lt;year={$(=max(year))}&amp;gt;} QTY)&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , year, product))&lt;/P&gt;&lt;P&gt;- sum({$&amp;lt;year={$(=max(year)-1)}&amp;gt;} aggr&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (sum({$&amp;lt;year={$(=max(year)-1)}&amp;gt;} Sales)&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /sum({$&amp;lt;year={$(=max(year)-1)}&amp;gt;} QTY)&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , year, product))&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;*sum({$&amp;lt;year={$(=max(year)-1)}&amp;gt;} aggr&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (sum({$&amp;lt;year={$(=max(year)-1)}&amp;gt;} QTY)&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , year, product))&lt;/P&gt;&lt;P&gt;/&lt;/P&gt;&lt;P&gt;sum({$&amp;lt;year={$(=max(year)-1)}&amp;gt;} Sales)&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 May 2011 09:13:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Price-variance-calculation-with-aggr-and-set-analysis/m-p/285924#M499537</guid>
      <dc:creator />
      <dc:date>2011-05-10T09:13:42Z</dc:date>
    </item>
    <item>
      <title>Price variance calculation with aggr and set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Price-variance-calculation-with-aggr-and-set-analysis/m-p/285925#M499538</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; It is really helpfull example..&lt;/P&gt;&lt;P&gt;do you know how can i do it by date in insted of year?&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AE&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Jun 2011 21:19:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Price-variance-calculation-with-aggr-and-set-analysis/m-p/285925#M499538</guid>
      <dc:creator />
      <dc:date>2011-06-02T21:19:41Z</dc:date>
    </item>
    <item>
      <title>Price variance calculation with aggr and set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Price-variance-calculation-with-aggr-and-set-analysis/m-p/285926#M499539</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well the reason the simplified version works is because you have the total mode set on "Sum of Rows" whereas in the incorrect version you have it set on "Expression Total".&amp;nbsp; To be honest I really don't understand what you're trying to do so I can't really be more helpful but I don't think just summing the rows is really what you want (it works fine now because it's 100 and 0, but I have a feeling that it isn't going to do what you want in a different situation).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Jun 2011 21:56:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Price-variance-calculation-with-aggr-and-set-analysis/m-p/285926#M499539</guid>
      <dc:creator />
      <dc:date>2011-06-02T21:56:09Z</dc:date>
    </item>
    <item>
      <title>Price variance calculation with aggr and set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Price-variance-calculation-with-aggr-and-set-analysis/m-p/285927#M499540</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Trent, you are right, the "simplified" version works only for this example and cannot be used to calculate percentage variances.&lt;/P&gt;&lt;P&gt;The idea is to analyse &lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;sales variances &lt;/STRONG&gt;&lt;/SPAN&gt;over time. Basically, because &lt;STRONG&gt;sales = sales price * volume&lt;/STRONG&gt;, the sales variance can be caused by &lt;SPAN style="text-decoration: underline;"&gt;price variances &lt;/SPAN&gt;or &lt;SPAN style="text-decoration: underline;"&gt;volume variances&lt;/SPAN&gt;. The tricky thing is, that both variances can have &lt;SPAN class="bold"&gt;opposite signs (usually lower prices cause higher volumes, but does this lead to higher sales?)&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Jun 2011 07:44:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Price-variance-calculation-with-aggr-and-set-analysis/m-p/285927#M499540</guid>
      <dc:creator />
      <dc:date>2011-06-06T07:44:20Z</dc:date>
    </item>
    <item>
      <title>Re: Price variance calculation with aggr and set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Price-variance-calculation-with-aggr-and-set-analysis/m-p/285928#M499541</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have been trying to do a very similar calculation and with your .qvw I was able to get it to work and wanted to share the equation I developed around the aggr function.&amp;nbsp;&amp;nbsp; When I created an expression with this calculation, I could even remove the "Product" dimension and it would still calculate correctly.&amp;nbsp; Also, tested that if I wanted the key to be product-customer, I could just add a comma, after product and add Customer and that would work also.&amp;nbsp; Rhonda&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;aggr&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;BR /&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;({$&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;year&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;={&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style=": ; color: #808080; font-size: 8pt;"&gt;$(=max(year))&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt;}&amp;gt;} &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Sales&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)/&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;({$&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;year&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;={&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style=": ; color: #808080; font-size: 8pt;"&gt;$(=max(year))&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt;}&amp;gt;} &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;QTY&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)&lt;BR /&gt; -&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;({$&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;year&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;={&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style=": ; color: #808080; font-size: 8pt;"&gt;$(=max(year)-1)&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt;}&amp;gt;} &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Sales&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)/&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;({$&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;year&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;={&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style=": ; color: #808080; font-size: 8pt;"&gt;$(=max(year)-1)&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt;}&amp;gt;} &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;QTY&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;))&lt;BR /&gt; *&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;({$&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;year&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;={&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style=": ; color: #808080; font-size: 8pt;"&gt;$(=max(year)-1)&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt;}&amp;gt;} &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;QTY&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;),&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;product&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Jan 2015 15:37:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Price-variance-calculation-with-aggr-and-set-analysis/m-p/285928#M499541</guid>
      <dc:creator />
      <dc:date>2015-01-21T15:37:36Z</dc:date>
    </item>
  </channel>
</rss>

