<?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 Fixed expression to calculate averages in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Fixed-expression-to-calculate-averages/m-p/185477#M49941</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe add {1} to it to tell it you want it to ignore all selections?&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;if(avg({1} TOTAL &amp;lt;[Product Code]&amp;gt; [Sale Price] )&amp;gt;=sum([Sale Price]),sum([Sale Price]))&lt;/P&gt;&lt;P&gt;Or maybe like this if you're earlier than version 8.5. Well, it should behave the same in 8.5 and 9.0 as well, but is no longer officially supported as best I can tell:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;if(avg(ALL &amp;lt;[Product Code]&amp;gt; [Sale Price] )&amp;gt;=sum([Sale Price]),sum([Sale Price]))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 11 Jun 2010 23:46:40 GMT</pubDate>
    <dc:creator>johnw</dc:creator>
    <dc:date>2010-06-11T23:46:40Z</dc:date>
    <item>
      <title>Fixed expression to calculate averages</title>
      <link>https://community.qlik.com/t5/QlikView/Fixed-expression-to-calculate-averages/m-p/185476#M49940</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All!&lt;/P&gt;&lt;P&gt;Hope you can help me, I have a chart that shows me all products that were less than the average using the following expression:&lt;B&gt;&lt;/B&gt;&lt;/P&gt;&lt;P style="font-weight: bold"&gt;if&lt;/P&gt;&lt;B&gt;&lt;/B&gt;&lt;P style="font-weight: bold"&gt;&lt;/P&gt;(&lt;B&gt;avg&lt;/B&gt;(&lt;B&gt;TOTAL&lt;/B&gt; &amp;lt;&lt;B&gt;[Product Code]&lt;/B&gt;&amp;gt; &lt;B&gt;[Sale Price]&lt;/B&gt; )&amp;gt;=&lt;B&gt;sum&lt;/B&gt;(&lt;B&gt;[Sale Price]&lt;/B&gt;),&lt;B&gt;sum&lt;/B&gt;(&lt;B&gt;[Sale Price]&lt;/B&gt;)) &lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;But QlikView obivously works where if you select something the expression will dynamically change, i.e. if i select one product the average would be the sale price of that product, as there is nothing to compare it to - whereas I want it to compare to the average for that product for all customers and orders.... any ideas?&lt;/P&gt;&lt;P&gt;I would really appreciate anything you can do to help!!&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;BR /&gt;Dayna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Jun 2010 10:25:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Fixed-expression-to-calculate-averages/m-p/185476#M49940</guid>
      <dc:creator>Dayna</dc:creator>
      <dc:date>2010-06-11T10:25:34Z</dc:date>
    </item>
    <item>
      <title>Fixed expression to calculate averages</title>
      <link>https://community.qlik.com/t5/QlikView/Fixed-expression-to-calculate-averages/m-p/185477#M49941</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe add {1} to it to tell it you want it to ignore all selections?&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;if(avg({1} TOTAL &amp;lt;[Product Code]&amp;gt; [Sale Price] )&amp;gt;=sum([Sale Price]),sum([Sale Price]))&lt;/P&gt;&lt;P&gt;Or maybe like this if you're earlier than version 8.5. Well, it should behave the same in 8.5 and 9.0 as well, but is no longer officially supported as best I can tell:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;if(avg(ALL &amp;lt;[Product Code]&amp;gt; [Sale Price] )&amp;gt;=sum([Sale Price]),sum([Sale Price]))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Jun 2010 23:46:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Fixed-expression-to-calculate-averages/m-p/185477#M49941</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2010-06-11T23:46:40Z</dc:date>
    </item>
    <item>
      <title>Fixed expression to calculate averages</title>
      <link>https://community.qlik.com/t5/QlikView/Fixed-expression-to-calculate-averages/m-p/185478#M49942</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello John,&lt;/P&gt;&lt;P&gt;That is perfect for the code! However, my slight issue now is that we have 200+ customers and obviously it shows them all... How could I get the expression to calculate with everything, but only show the appropriate customers (i.e. pick North Customers and only see the relevant customers rather than all...)&lt;/P&gt;&lt;P&gt;Many thanks John!&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;BR /&gt;Dayna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Jun 2010 10:21:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Fixed-expression-to-calculate-averages/m-p/185478#M49942</guid>
      <dc:creator>Dayna</dc:creator>
      <dc:date>2010-06-14T10:21:39Z</dc:date>
    </item>
    <item>
      <title>Fixed expression to calculate averages</title>
      <link>https://community.qlik.com/t5/QlikView/Fixed-expression-to-calculate-averages/m-p/185479#M49943</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, how best to do it depends on exactly which selections you want to pay attention to, and which you want to ignore. At this point, all I think I know is that you want to pay attention to customers, but NOT to product codes.&lt;/P&gt;&lt;P&gt;I think this would work for "ignore ONLY product code selections":&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;if(avg({&amp;lt;[Product Code]=&amp;gt;} TOTAL &amp;lt;[Product Code]&amp;gt; [Sale Price] )&amp;gt;=sum([Sale Price]),sum([Sale Price]))&lt;/P&gt;&lt;P&gt;I think this would work for "ignore all selections EXCEPT for customer" (in 9.0, anyway. P(field) doesn't work in 8.5):&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;if(avg({1&amp;lt;[Customer]=P([Customer])&amp;gt;} TOTAL &amp;lt;[Product Code]&amp;gt; [Sale Price] )&amp;gt;=sum([Sale Price]),sum([Sale Price]))&lt;/P&gt;&lt;P&gt;In any case, you have two basic possiblities that I know of. You can either start with NO selections {1} and then explicitly tell it field=P(field) for each field you want to use selections for. Or you can start with ALL selections (not specifying {1}) and then explicitly tell it which selections to ignore with field=.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Jun 2010 17:21:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Fixed-expression-to-calculate-averages/m-p/185479#M49943</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2010-06-14T17:21:16Z</dc:date>
    </item>
    <item>
      <title>Fixed expression to calculate averages</title>
      <link>https://community.qlik.com/t5/QlikView/Fixed-expression-to-calculate-averages/m-p/185480#M49944</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's great, thank you very much for your help, John. I'll have a play and see what I get!&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;BR /&gt;Dayna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Jun 2010 09:52:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Fixed-expression-to-calculate-averages/m-p/185480#M49944</guid>
      <dc:creator>Dayna</dc:creator>
      <dc:date>2010-06-15T09:52:29Z</dc:date>
    </item>
  </channel>
</rss>

