<?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: Weighted Distribution in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Weighted-Distribution/m-p/450701#M485983</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much! You are my hero... I need to learn what this "aggr" function does, clearly! &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 18 Mar 2013 14:04:19 GMT</pubDate>
    <dc:creator />
    <dc:date>2013-03-18T14:04:19Z</dc:date>
    <item>
      <title>Weighted Distribution</title>
      <link>https://community.qlik.com/t5/QlikView/Weighted-Distribution/m-p/450695#M485975</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi guys, I'm relatively new to Qlikview and have a little problem I can't solve! &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/sad.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've had a look at a previous topic which covered this same problem in broken English however it was never resolved...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Numeric distribution referes to the actual number of stores a product is sold in. I have figured that out and got it working fine with the formula below&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 _jivemacro_uid_13636109736315248" jivemacro_uid="_13636109736315248"&gt;&lt;P&gt;=count({$&amp;lt;Units={"&amp;gt;0"} &amp;gt;} distinct [Store Name]) / count(total [Store Name])&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above expression counts all stores where "Unit Sales" are above 0 and divides it by ALL stores to give a percentage of all stores the product sold in. Easy enough...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, I am unable to solve the issue when it comes to weighted distribution.&lt;/P&gt;&lt;P&gt;In words: Weighted distribution should take the sum (not count) of ALL sales for a ALL products in a store where each product's sales was greater than 0 and divide this number by the total sales overall.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've created a summary in xlsx attached to show what I want to achieve, as it is quite hard to define in words. The weighting is to the total Sales of all products.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For what it is worth I want this to be dynamic, in that I have a hierarchy of products as my dimension in a table and would like to be able to dynamically calculate each products weighted distribution. A "text-box" solution isn't an option unfortunately.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Cindy &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/wink.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Mar 2013 13:01:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Weighted-Distribution/m-p/450695#M485975</guid>
      <dc:creator />
      <dc:date>2013-03-18T13:01:45Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted Distribution</title>
      <link>https://community.qlik.com/t5/QlikView/Weighted-Distribution/m-p/450696#M485976</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Cindy,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. add product as your dimension&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. use expression&amp;nbsp; if (sum(salesamount)&amp;gt;0,(sum(salesamount)/sum(Total salesamount))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;what it will do it will chech whether that individual product is grator then 0 , if yes then it will divide that&lt;/P&gt;&lt;P&gt;salesamount by all sales amount like wise it will distribute for all products.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;anant&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Mar 2013 13:12:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Weighted-Distribution/m-p/450696#M485976</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-03-18T13:12:11Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted Distribution</title>
      <link>https://community.qlik.com/t5/QlikView/Weighted-Distribution/m-p/450697#M485977</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try: if(sum(Units)&amp;gt;0,sum({$&amp;lt;Units={"&amp;gt;0"} total &amp;lt;[Store Name]&amp;gt; Units)/sum(total Units),0)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Mar 2013 13:16:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Weighted-Distribution/m-p/450697#M485977</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-03-18T13:16:30Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted Distribution</title>
      <link>https://community.qlik.com/t5/QlikView/Weighted-Distribution/m-p/450698#M485980</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Unfortunately I just get 100% for every product, which is obviously not correct... I agree with your method/logic though. So frustrating! &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Mar 2013 13:23:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Weighted-Distribution/m-p/450698#M485980</guid>
      <dc:creator />
      <dc:date>2013-03-18T13:23:55Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted Distribution</title>
      <link>https://community.qlik.com/t5/QlikView/Weighted-Distribution/m-p/450699#M485981</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The problem is we are not getting a total sales for the store, for each Product.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the first part of the expression needs to sum the total sales of all stores that EACH product is in, these stores will change from one product to the next. I think that's the issue but I'm not clever enough to figure out how to recitfy this! &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/silly.png" /&gt; hahaha &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Mar 2013 13:33:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Weighted-Distribution/m-p/450699#M485981</guid>
      <dc:creator />
      <dc:date>2013-03-18T13:33:34Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted Distribution</title>
      <link>https://community.qlik.com/t5/QlikView/Weighted-Distribution/m-p/450700#M485982</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Cindy&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this in your expression&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if &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: #800000; font-size: 8pt;"&gt;Units&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)&amp;gt;0,&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;(&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &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;Units&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;={'&amp;gt;0'}&amp;gt;}&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;total&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Store&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Units&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;), &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Store&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;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;BR /&gt; )&lt;BR /&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;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;total&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Units&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)&lt;BR /&gt;, &lt;BR /&gt; 0&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;it works on the example file&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;best regards&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Christian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Mar 2013 13:53:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Weighted-Distribution/m-p/450700#M485982</guid>
      <dc:creator />
      <dc:date>2013-03-18T13:53:35Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted Distribution</title>
      <link>https://community.qlik.com/t5/QlikView/Weighted-Distribution/m-p/450701#M485983</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much! You are my hero... I need to learn what this "aggr" function does, clearly! &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Mar 2013 14:04:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Weighted-Distribution/m-p/450701#M485983</guid>
      <dc:creator />
      <dc:date>2013-03-18T14:04:19Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted Distribution</title>
      <link>https://community.qlik.com/t5/QlikView/Weighted-Distribution/m-p/450702#M485984</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Cindy,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;just ask...here it is.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;best regards&lt;/P&gt;&lt;P&gt;christian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Mar 2013 11:28:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Weighted-Distribution/m-p/450702#M485984</guid>
      <dc:creator />
      <dc:date>2013-03-20T11:28:20Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted Distribution</title>
      <link>https://community.qlik.com/t5/QlikView/Weighted-Distribution/m-p/450703#M485985</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Excellent! Thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Mar 2013 11:39:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Weighted-Distribution/m-p/450703#M485985</guid>
      <dc:creator />
      <dc:date>2013-03-20T11:39:19Z</dc:date>
    </item>
  </channel>
</rss>

