<?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 average with set analysis/if statements in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/weighted-average-with-set-analysis-if-statements/m-p/1747831#M720620</link>
    <description>&lt;P&gt;Hi just looking at the syntax, the expression appears to be correct.&amp;nbsp; make sure all fields are correct.&amp;nbsp; If the expression is correct, you dont need to AGGR by month, jut add month as the dimension and this as the expression - then it means it is aggregated by month.&lt;BR /&gt;the expression does not give anyone unfamiliar with your data model enough information to answer your question so a lot of assumptions have to be made.&amp;nbsp; if this does not help maybe providing more info would help someone else help you.&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 17:54:42 GMT</pubDate>
    <dc:creator>edwin</dc:creator>
    <dc:date>2020-09-28T17:54:42Z</dc:date>
    <item>
      <title>weighted average with set analysis/if statements</title>
      <link>https://community.qlik.com/t5/QlikView/weighted-average-with-set-analysis-if-statements/m-p/1747817#M720619</link>
      <description>&lt;P&gt;I want to calculate a monthly weighted average using a price field called CYCLE_AVG and volume field called Volume. However, both fields have conditions. For prices, I need only prices each day that are for Spot/spot and for volumes I only want daily Bulk volumes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried the formula below in a pivot table but it says the expression has an error. Also do I need to aggregate the total volumes by the monthly dimension to get total volumes for the month?&lt;/P&gt;&lt;P&gt;sum(Avg({$&amp;lt;GRIDPT_LABEL_TXT={'Spot/spot'}&amp;gt;} CYCLE_AVG)*Sum({$&amp;lt;[Bulk Rack]={'Bulk'}&amp;gt;} Volume))/Sum({$&amp;lt;[Bulk Rack]={'Bulk'}&amp;gt;} Volume)&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/weighted-average-with-set-analysis-if-statements/m-p/1747817#M720619</guid>
      <dc:creator>sarahshong</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: weighted average with set analysis/if statements</title>
      <link>https://community.qlik.com/t5/QlikView/weighted-average-with-set-analysis-if-statements/m-p/1747831#M720620</link>
      <description>&lt;P&gt;Hi just looking at the syntax, the expression appears to be correct.&amp;nbsp; make sure all fields are correct.&amp;nbsp; If the expression is correct, you dont need to AGGR by month, jut add month as the dimension and this as the expression - then it means it is aggregated by month.&lt;BR /&gt;the expression does not give anyone unfamiliar with your data model enough information to answer your question so a lot of assumptions have to be made.&amp;nbsp; if this does not help maybe providing more info would help someone else help you.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 17:54:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/weighted-average-with-set-analysis-if-statements/m-p/1747831#M720620</guid>
      <dc:creator>edwin</dc:creator>
      <dc:date>2020-09-28T17:54:42Z</dc:date>
    </item>
    <item>
      <title>Re: weighted average with set analysis/if statements</title>
      <link>https://community.qlik.com/t5/QlikView/weighted-average-with-set-analysis-if-statements/m-p/1747864#M720621</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/44131"&gt;@sarahshong&lt;/a&gt;&amp;nbsp; you may need to use aggr function here to work your expression as expected. Try below&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;sum(aggr((Avg({$&amp;lt;GRIDPT_LABEL_TXT={'Spot/spot'}&amp;gt;} CYCLE_AVG)*Sum({$&amp;lt;[Bulk Rack]={'Bulk'}&amp;gt;} Volume))/Sum({$&amp;lt;[Bulk Rack]={'Bulk'}&amp;gt;} Volume), Month))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you have more dimension is pivot table you may need to add that as well in your aggr function&lt;/P&gt;&lt;P&gt;or you can simply try removing outer sum function as below&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;(Avg({$&amp;lt;GRIDPT_LABEL_TXT={'Spot/spot'}&amp;gt;} CYCLE_AVG)*Sum({$&amp;lt;[Bulk Rack]={'Bulk'}&amp;gt;} Volume))/Sum({$&amp;lt;[Bulk Rack]={'Bulk'}&amp;gt;} Volume)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 20:54:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/weighted-average-with-set-analysis-if-statements/m-p/1747864#M720621</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2020-09-28T20:54:35Z</dc:date>
    </item>
  </channel>
</rss>

