<?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 arithmetic mean avoiding duplicates in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Weighted-arithmetic-mean-avoiding-duplicates/m-p/1441877#M801939</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or this?&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Sum(TOTAL &amp;lt;Subregion&amp;gt; (Weight * Target)) / Sum(TOTAL &lt;STRONG style="font-size: 13.3333px;"&gt;&amp;lt;Subregion&amp;gt;&lt;/STRONG&gt; Weight)&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 22 Nov 2017 12:19:58 GMT</pubDate>
    <dc:creator>Anil_Babu_Samineni</dc:creator>
    <dc:date>2017-11-22T12:19:58Z</dc:date>
    <item>
      <title>Weighted arithmetic mean avoiding duplicates</title>
      <link>https://community.qlik.com/t5/QlikView/Weighted-arithmetic-mean-avoiding-duplicates/m-p/1441875#M801937</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to do a weighted arithmetic mean&lt;STRONG style="color: #222222; font-family: sans-serif; font-size: 14px;"&gt; &lt;/STRONG&gt;something like: (a*weight(a)+b*weight(b) +....) / (weight(a)+weight(b) +...). I am able to do this but the problem are the duplicates. I will explain further:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Product line, Year-Quarter, Subregion, Weight, Target&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Alpha, FY17-Q4, Spain, 12, 50&lt;/P&gt;&lt;P&gt;Alpha, FY17-Q4, Portugal, 15, 70&lt;/P&gt;&lt;P&gt;Alpha, FY17-Q4, Norway, 13, 80&lt;/P&gt;&lt;P&gt;Alpha, FY17-Q4, Dennmark, 18, 60&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to represent the Target of the Region Europe( Iberia(Spain+Portugal) + North Europe(Norway+Dennmark) ), so i need to do: (12*50+15*70+13*80+18*60) / (12 +15+13+18).&lt;/P&gt;&lt;P&gt;To do this i have this expression:&lt;/P&gt;&lt;P&gt;sum(Target * Weight)/sum(Weight)&lt;/P&gt;&lt;P&gt;This is not working, i think that becose of the duplicates. I tried to use Distinct in the load script but it is not working (the scripts is huge and messy, someone made it a long time ago and left that monster as a present).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style=": ; font-size: 10pt;"&gt;Is there a way to make the sum but only one value of Target and Weight for each SubRegion??&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Thanks for the help,&lt;/P&gt;&lt;P&gt;I can explain further if needed. &lt;/P&gt;&lt;P&gt;&lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Weighted-arithmetic-mean-avoiding-duplicates/m-p/1441875#M801937</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted arithmetic mean avoiding duplicates</title>
      <link>https://community.qlik.com/t5/QlikView/Weighted-arithmetic-mean-avoiding-duplicates/m-p/1441876#M801938</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How about this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Sum(TOTAL (Weight * Target)) / Sum(TOTAL Weight)&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Nov 2017 12:19:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Weighted-arithmetic-mean-avoiding-duplicates/m-p/1441876#M801938</guid>
      <dc:creator>Anil_Babu_Samineni</dc:creator>
      <dc:date>2017-11-22T12:19:10Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted arithmetic mean avoiding duplicates</title>
      <link>https://community.qlik.com/t5/QlikView/Weighted-arithmetic-mean-avoiding-duplicates/m-p/1441877#M801939</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or this?&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Sum(TOTAL &amp;lt;Subregion&amp;gt; (Weight * Target)) / Sum(TOTAL &lt;STRONG style="font-size: 13.3333px;"&gt;&amp;lt;Subregion&amp;gt;&lt;/STRONG&gt; Weight)&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Nov 2017 12:19:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Weighted-arithmetic-mean-avoiding-duplicates/m-p/1441877#M801939</guid>
      <dc:creator>Anil_Babu_Samineni</dc:creator>
      <dc:date>2017-11-22T12:19:58Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted arithmetic mean avoiding duplicates</title>
      <link>https://community.qlik.com/t5/QlikView/Weighted-arithmetic-mean-avoiding-duplicates/m-p/1441878#M801940</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Sum(Aggr(Target * Weight, [Product line], [Year-Quarter], SubRegion))/&lt;/STRONG&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;STRONG&gt;Sum(Aggr(Weight, [Product line], [Year-Quarter], SubRegion))&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Nov 2017 12:21:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Weighted-arithmetic-mean-avoiding-duplicates/m-p/1441878#M801940</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2017-11-22T12:21:51Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted arithmetic mean avoiding duplicates</title>
      <link>https://community.qlik.com/t5/QlikView/Weighted-arithmetic-mean-avoiding-duplicates/m-p/1441879#M801941</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Either of them is working. I think that the problem is that for each Subregion there are around 200 duplicates of the weight. If i could only use 1 I think it would work. I also tried &lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Sum(DISTINCT (Weight * Target)) / Sum(DISTINCT Weight) &lt;/STRONG&gt;but sometimes the weights have the same value so it causes problems.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Lluís &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Nov 2017 12:26:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Weighted-arithmetic-mean-avoiding-duplicates/m-p/1441879#M801941</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-22T12:26:00Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted arithmetic mean avoiding duplicates</title>
      <link>https://community.qlik.com/t5/QlikView/Weighted-arithmetic-mean-avoiding-duplicates/m-p/1441880#M801942</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Expected result from given data?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Nov 2017 12:40:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Weighted-arithmetic-mean-avoiding-duplicates/m-p/1441880#M801942</guid>
      <dc:creator>Anil_Babu_Samineni</dc:creator>
      <dc:date>2017-11-22T12:40:56Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted arithmetic mean avoiding duplicates</title>
      <link>https://community.qlik.com/t5/QlikView/Weighted-arithmetic-mean-avoiding-duplicates/m-p/1441881#M801943</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;This: (12*50+15*70+13*80+18*60) / (12 +15+13+18).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;As I said the problem is that there are many duplicates of the weights for each subregion (I dont understand where they come from).&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Nov 2017 12:53:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Weighted-arithmetic-mean-avoiding-duplicates/m-p/1441881#M801943</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-22T12:53:37Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted arithmetic mean avoiding duplicates</title>
      <link>https://community.qlik.com/t5/QlikView/Weighted-arithmetic-mean-avoiding-duplicates/m-p/1441882#M801944</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you give this a shot?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Sum(Aggr(Target * Weight, [Product line], [Year-Quarter], SubRegion))/&lt;/STRONG&gt;&lt;SPAN style="font-size: 13.3333px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-style: inherit; font-size: 13.3333px; font-family: inherit;"&gt;Sum(Aggr(Weight, [Product line], [Year-Quarter], SubRegion))&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Sum(Aggr(Target * Weight, SubRegion))/&lt;/STRONG&gt;&lt;SPAN style="font-size: 13.3333px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-style: inherit; font-size: 13.3333px; font-family: inherit;"&gt;Sum(Aggr(Weight, SubRegion))&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Nov 2017 12:55:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Weighted-arithmetic-mean-avoiding-duplicates/m-p/1441882#M801944</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2017-11-22T12:55:13Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted arithmetic mean avoiding duplicates</title>
      <link>https://community.qlik.com/t5/QlikView/Weighted-arithmetic-mean-avoiding-duplicates/m-p/1441883#M801945</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This totally worked!! Thanks!! &lt;/P&gt;&lt;P&gt;I will leave this link just in case someone (like i did) needs further info about Aggr &lt;A href="https://community.qlik.com/thread/38796"&gt;Aggr() function&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Thanks toboth of you! &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Nov 2017 13:54:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Weighted-arithmetic-mean-avoiding-duplicates/m-p/1441883#M801945</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-22T13:54:43Z</dc:date>
    </item>
  </channel>
</rss>

