<?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 weighted averages with aggr in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/weighted-averages-with-aggr/m-p/336395#M493231</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are assuming well, they are linked by Date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I´ve tried what you said but I`m getting incorrect results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thank´s&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 04 Jun 2012 17:20:27 GMT</pubDate>
    <dc:creator>chematos</dc:creator>
    <dc:date>2012-06-04T17:20:27Z</dc:date>
    <item>
      <title>weighted averages with aggr</title>
      <link>https://community.qlik.com/t5/QlikView/weighted-averages-with-aggr/m-p/336393#M493229</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I´m trying to use aggr function to calculate weighted averages.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have data like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="0" cellspacing="0" class="jiveBorder" style="width: 757px;"&gt;&lt;TBODY&gt;&lt;TR style="height: 12.75pt;"&gt;&lt;TD class="xl65" height="17" style="height: 12.75pt; width: 62pt;" width="83"&gt;&lt;STRONG&gt;I/D&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none; width: 194pt;" width="259"&gt;&lt;STRONG&gt;LINEA&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none; width: 44pt;" width="58"&gt;&lt;STRONG&gt;CENTRO&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none; width: 37pt;" width="49"&gt;&lt;STRONG&gt;TIPO&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;STRONG&gt;Promedio&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none; width: 58pt;" width="77"&gt;&lt;STRONG&gt; AñoPeriodo&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none; width: 44pt;" width="59"&gt;&lt;STRONG&gt; nPeriodo&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none; width: 23pt;" width="30"&gt;&lt;STRONG&gt; Mes&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none; width: 59pt;" width="78"&gt;&lt;STRONG&gt; %Fecha&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 757px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl63" height="17" width="83"&gt;DIRECTO&lt;/TD&gt;&lt;TD class="xl63" style="border-left-style: none;" width="259"&gt;LECHE&lt;/TD&gt;&lt;TD class="xl63" style="border-left-style: none;" width="58"&gt;700042&lt;/TD&gt;&lt;TD class="xl63" style="border-left-style: none;" width="49"&gt;Efectivo&lt;/TD&gt;&lt;TD class="xl63" style="border-left-style: none;" width="64"&gt;0.61&lt;/TD&gt;&lt;TD class="xl63" style="border-left-style: none;" width="77"&gt;2010&lt;/TD&gt;&lt;TD class="xl63" style="border-left-style: none;" width="59"&gt;1&lt;/TD&gt;&lt;TD class="xl63" style="border-left-style: none;" width="30"&gt;Ago&lt;/TD&gt;&lt;TD align="right" class="xl64" style="border-left-style: none;" width="78"&gt;31/08/2010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="17" style="border-top-style: none;"&gt;DIRECTO&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;LECHE&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;700042&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;Efectivo&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;0.74&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;2010&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;Ago&lt;/TD&gt;&lt;TD align="right" class="xl64" style="border-top-style: none; border-left-style: none;"&gt;31/08/2010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="17" style="border-top-style: none;"&gt;DIRECTO&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;LECHE&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;700042&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;Zafral&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;0.74&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;2010&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;Ago&lt;/TD&gt;&lt;TD align="right" class="xl64" style="border-top-style: none; border-left-style: none;"&gt;31/08/2010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="17" style="border-top-style: none;"&gt;DIRECTO&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;LECHE&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;700042&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;Efectivo&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;0.77&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;2010&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;Ago&lt;/TD&gt;&lt;TD align="right" class="xl64" style="border-top-style: none; border-left-style: none;"&gt;31/08/2010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="17" style="border-top-style: none;"&gt;DIRECTO&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;LECHE&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;700042&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;Efectivo&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;0.81&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;2010&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;Ago&lt;/TD&gt;&lt;TD align="right" class="xl64" style="border-top-style: none; border-left-style: none;"&gt;31/08/2010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="17" style="border-top-style: none;"&gt;DIRECTO&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;LECHE&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;700042&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;Efectivo&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;0.8&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;2010&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;2&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;Sep&lt;/TD&gt;&lt;TD align="right" class="xl64" style="border-top-style: none; border-left-style: none;"&gt;30/09/2010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="17" style="border-top-style: none;"&gt;DIRECTO&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;LECHE&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;700042&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;Efectivo&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;0.87&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;2010&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;2&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;Sep&lt;/TD&gt;&lt;TD align="right" class="xl64" style="border-top-style: none; border-left-style: none;"&gt;30/09/2010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="17" style="border-top-style: none;"&gt;DIRECTO&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;LECHE&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;700042&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;Zafral&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;0.87&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;2010&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;2&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;Sep&lt;/TD&gt;&lt;TD align="right" class="xl64" style="border-top-style: none; border-left-style: none;"&gt;30/09/2010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="17" style="border-top-style: none;"&gt;DIRECTO&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;LECHE&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;700042&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;Efectivo&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;0.68&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;2010&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;3&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;Oct&lt;/TD&gt;&lt;TD align="right" class="xl64" style="border-top-style: none; border-left-style: none;"&gt;31/10/2010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="17" style="border-top-style: none;"&gt;DIRECTO&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;LECHE&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;700042&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;Efectivo&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;0.74&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;2010&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;3&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;Oct&lt;/TD&gt;&lt;TD align="right" class="xl64" style="border-top-style: none; border-left-style: none;"&gt;31/10/2010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="17" style="border-top-style: none;"&gt;DIRECTO&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;LECHE&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;700042&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;Efectivo&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;0.77&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;2010&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;3&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;Oct&lt;/TD&gt;&lt;TD align="right" class="xl64" style="border-top-style: none; border-left-style: none;"&gt;31/10/2010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="17" style="border-top-style: none;"&gt;DIRECTO&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;LECHE&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;700042&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;Efectivo&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;0.81&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;2010&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;3&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;Oct&lt;/TD&gt;&lt;TD align="right" class="xl64" style="border-top-style: none; border-left-style: none;"&gt;31/10/2010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="17" style="border-top-style: none;"&gt;DIRECTO&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;LECHE&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;700042&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;Efectivo&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;0.84&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;2010&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;3&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;Oct&lt;/TD&gt;&lt;TD align="right" class="xl64" style="border-top-style: none; border-left-style: none;"&gt;31/10/2010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="17" style="border-top-style: none;"&gt;DIRECTO&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;LECHE&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;700042&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;Zafral&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;0.84&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;2010&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;3&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none;"&gt;Oct&lt;/TD&gt;&lt;TD align="right" class="xl64" style="border-top-style: none; border-left-style: none;"&gt;31/10/2010&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 186px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl66" height="17" width="106"&gt;&lt;STRONG&gt;Date&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl66" width="80"&gt;&lt;STRONG&gt;Days&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="17"&gt;31/08/2010&lt;/TD&gt;&lt;TD align="right"&gt;31&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="17" style="border-top-style: none;"&gt;30/09/2010&lt;/TD&gt;&lt;TD align="right"&gt;30&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="17" style="border-top-style: none;"&gt;31/10/2010&lt;/TD&gt;&lt;TD align="right"&gt;31&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is a particular case with a few months, so what I need is to add the averages (field Promedio) of the month multiplied by the days of the month for each month since Agoust to October and divide that result by the total days of those months&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 756px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl68" width="80"&gt;&lt;BR /&gt;&lt;/TD&gt;&lt;TD class="xl66" width="80"&gt;&lt;STRONG&gt;Avg Month&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl66" width="144"&gt;&lt;STRONG&gt;Days Month&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl66" width="106"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Avg Month*Days Month&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl66" width="80"&gt;&lt;STRONG&gt;Total Avgs&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="106"&gt;&lt;STRONG&gt;Total Days&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;weighted average&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="17"&gt;&lt;STRONG&gt;Ago&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl65"&gt;3,67&lt;/TD&gt;&lt;TD align="right"&gt;31&lt;/TD&gt;&lt;TD align="right"&gt;113,77&lt;/TD&gt;&lt;TD align="right"&gt;335,05&lt;/TD&gt;&lt;TD align="right"&gt;92&lt;/TD&gt;&lt;TD align="right"&gt;3,64&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="17"&gt;Sep&lt;/TD&gt;&lt;TD align="right" class="xl65"&gt;2,54&lt;/TD&gt;&lt;TD align="right"&gt;30&lt;/TD&gt;&lt;TD align="right"&gt;76,2&lt;/TD&gt;&lt;TD&gt;&lt;BR /&gt;&lt;/TD&gt;&lt;TD&gt;&lt;BR /&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="17"&gt;Oct&lt;/TD&gt;&lt;TD align="right" class="xl65"&gt;4,68&lt;/TD&gt;&lt;TD align="right"&gt;31&lt;/TD&gt;&lt;TD align="right"&gt;145,08&lt;/TD&gt;&lt;TD&gt;&lt;BR /&gt;&lt;/TD&gt;&lt;TD&gt;&lt;BR /&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is my first aggr function and I have a doubt apart of all this, in the aggr function, the dimensions would be like a group by??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Well, this is my function and it´s not working at all.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum(&lt;STRONG&gt;aggr(sum({&amp;lt;Periodo={'&amp;lt;=$(=Periodo)'},AñoPeriodo={'=$(=AñoPeriodo)'},PERIODO=&amp;gt;}Promedio)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;,%Fecha,CENTRO,TIPO,nPeriodo) &lt;/STRONG&gt;* DaysMonth) &lt;/P&gt;&lt;P&gt;/&lt;/P&gt;&lt;P&gt;sum({&amp;lt;Periodo={'&amp;lt;=$(=Periodo)'},AñoEjercicio={'=$(=AñoEjercicio)'},PERIODO=&amp;gt;}DaysMonth)&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;Chema.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Jun 2012 16:54:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/weighted-averages-with-aggr/m-p/336393#M493229</guid>
      <dc:creator>chematos</dc:creator>
      <dc:date>2012-06-04T16:54:18Z</dc:date>
    </item>
    <item>
      <title>weighted averages with aggr</title>
      <link>https://community.qlik.com/t5/QlikView/weighted-averages-with-aggr/m-p/336394#M493230</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm assuming that the two tables that you described, are associated by Date. If they are not linked, the following won't work correctly. You have to make sure that the two tables are linked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, try including the multiplication by DaysMonth inside of your AGGR calculation:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum(&lt;STRONG&gt;aggr(sum({&amp;lt;Periodo={'&amp;lt;=$(=Periodo)'},AñoPeriodo={'=$(=AñoPeriodo)'},PERIODO=&amp;gt;} &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Promedio&lt;/STRONG&gt;* DaysMonth&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;,%Fecha,CENTRO,TIPO,nPeriodo) &lt;/STRONG&gt;) &lt;/P&gt;&lt;P&gt;/&lt;/P&gt;&lt;P&gt;sum({&amp;lt;Periodo={'&amp;lt;=$(=Periodo)'},AñoEjercicio={'=$(=AñoEjercicio)'},PERIODO=&amp;gt;}DaysMonth)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Jun 2012 17:01:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/weighted-averages-with-aggr/m-p/336394#M493230</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2012-06-04T17:01:57Z</dc:date>
    </item>
    <item>
      <title>weighted averages with aggr</title>
      <link>https://community.qlik.com/t5/QlikView/weighted-averages-with-aggr/m-p/336395#M493231</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are assuming well, they are linked by Date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I´ve tried what you said but I`m getting incorrect results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thank´s&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Jun 2012 17:20:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/weighted-averages-with-aggr/m-p/336395#M493231</guid>
      <dc:creator>chematos</dc:creator>
      <dc:date>2012-06-04T17:20:27Z</dc:date>
    </item>
    <item>
      <title>weighted averages with aggr</title>
      <link>https://community.qlik.com/t5/QlikView/weighted-averages-with-aggr/m-p/336396#M493232</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not sure why you have different Set Analysis condition in the numerator and in the denominator - usually the conditions should be the same for the weighted average logic to work correctly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you post an example, we could try and and find the problem, otherwise it's very hard to guess...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Jun 2012 17:28:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/weighted-averages-with-aggr/m-p/336396#M493232</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2012-06-04T17:28:56Z</dc:date>
    </item>
    <item>
      <title>weighted averages with aggr</title>
      <link>https://community.qlik.com/t5/QlikView/weighted-averages-with-aggr/m-p/336397#M493233</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I know but I can´t upload it right now. The behaviour is as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;User selects a Period, imagine that is October 2010, so because my fiscal year starts in August, I need to make calculations between those months in the same year, that´s the reason of my conditions in numerator and denominator: &lt;STRONG style="background-color: #ffffff; font-size: 12px; color: #636363; font-family: Arial;"&gt;{&amp;lt;Periodo={'&amp;lt;=$(=Periodo)'},AñoPeriodo={'=$(=AñoPeriodo)'},PERIODO=&amp;gt;} //Periodo or Month is the same because they are linked in my calendar so Perdiodo =1 is Month = August&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #636363; font-size: 12px; background-color: #ffffff; font-family: Arial;"&gt;&lt;STRONG style="background-color: #ffffff; font-size: 12px; color: #636363; font-family: Arial;"&gt;%Fecha,CENTRO,TIPO,nPeriodo&amp;nbsp; //with &lt;/STRONG&gt;&lt;STRONG style="background-color: #ffffff; font-size: 12px; color: #636363; font-family: Arial;"&gt;these dimensions I want to add the averages in the numerator by month but each month multiplied by days of month:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Avg August * 31 + Avg September * 30 + Avg October *31&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #636363; font-size: 12px; background-color: #ffffff; font-family: Arial;"&gt;&lt;STRONG style="background-color: #ffffff; font-size: 12px; color: #636363; font-family: Arial;"&gt;and the denominator must be 31+30+31, total days of the three months.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #636363; font-size: 12px; background-color: #ffffff; font-family: Arial;"&gt;If the syntax of my expression is correct, I need to pay more attention on the relationships of my tables but I don´t see anything strange...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;May be I need to calculate something in the load, I don´t know wich is the best way to resolve it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you anyway.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #636363; font-size: 12px; background-color: #ffffff; font-family: Arial;"&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Jun 2012 18:14:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/weighted-averages-with-aggr/m-p/336397#M493233</guid>
      <dc:creator>chematos</dc:creator>
      <dc:date>2012-06-04T18:14:16Z</dc:date>
    </item>
    <item>
      <title>weighted averages with aggr</title>
      <link>https://community.qlik.com/t5/QlikView/weighted-averages-with-aggr/m-p/336398#M493234</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Finally, I resolved it without aggr function but I´ve learned about that, so I´m happy!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If anyone is interested, the best way I found is creating other table in the load script with partial sums for each month like: sum(Promedio)*DaysMonth grouping by Month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So we have in another table the Month or Date with DaysMonth. &lt;/P&gt;&lt;P&gt;Finally, this would be the expression where we add all month averages until the month selected and depending on the dimensionality, we calculate the weighted average dividing by Total Days until the month selected or we calculate the simple average dividing by the number of months until the month selected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(Dimensionality()=5,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum({&amp;lt;Period={'&amp;lt;=$(=Period)'},FiscalYear={'=$(=FiscalYear)'},PERIOD=&amp;gt;}[Avg Month])&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum({&amp;lt;Period={'&amp;lt;=$(=Period)'},FiscalYear={'=$(=FiscalYear)'},PERIOD=&amp;gt;}DaysMonth)&lt;/P&gt;&lt;P&gt;,sum({&amp;lt;Period={'&amp;lt;=$(=Period)'},FiscalYear={'=$(=FiscalYear)'},PERIOD=&amp;gt;}Avg)&lt;/P&gt;&lt;P&gt;/&lt;/P&gt;&lt;P&gt;nPeriod)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Jun 2012 20:18:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/weighted-averages-with-aggr/m-p/336398#M493234</guid>
      <dc:creator>chematos</dc:creator>
      <dc:date>2012-06-04T20:18:25Z</dc:date>
    </item>
  </channel>
</rss>

