<?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: Help with Average but ignore zero in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Help-with-Average-but-ignore-zero/m-p/91181#M751990</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thats great, thanks Sunny, i have used the first solution you gave. the second one gave different results in my real data to the first for some reason. &lt;/P&gt;&lt;P&gt;Thanks for your help. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 30 Oct 2018 13:34:22 GMT</pubDate>
    <dc:creator>hopkinsc</dc:creator>
    <dc:date>2018-10-30T13:34:22Z</dc:date>
    <item>
      <title>Help with Average but ignore zero</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-Average-but-ignore-zero/m-p/91178#M751987</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 have some expressions that give sales by year. i have some years that are zero and i am trying to ignore those zeros when using avg(). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;example..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;item 123 has sales in 2013, 2015, 2016 and 2017 but no sales in 2014 and 2018&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have a straight table that has the last 5 years sales (so i am not including 2013).&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.JPG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/217085_Capture.JPG" style="height: 85px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The AVG() is taking the full sales values (including 2013) and averaging it across all years, but what i actually want it to do is to only sum the years with values that i have in the chart (2015, 2016, 2017) and divide that total by 3 (as only 3 of the years have values)&lt;/P&gt;&lt;P&gt;so in this example i am trying to get 366.6&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone help? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sample attached. &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/Help-with-Average-but-ignore-zero/m-p/91178#M751987</guid>
      <dc:creator>hopkinsc</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Average but ignore zero</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-Average-but-ignore-zero/m-p/91179#M751988</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({&amp;lt;Year={$(=Max(Year)), $(=Max(Year)-1), $(=Max(Year)-2), $(=Max(Year)-3), $(=Max(Year)-4)}&amp;gt;}sales)/&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Count(DISTINCT {&amp;lt;sales = {"&amp;gt;0"}, Year={$(=Max(Year)), $(=Max(Year)-1), $(=Max(Year)-2), $(=Max(Year)-3), $(=Max(Year)-4)}&amp;gt;} Year)&lt;/STRONG&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&gt;Avg({&amp;lt;Year={$(=Max(Year)), $(=Max(Year)-1), $(=Max(Year)-2), $(=Max(Year)-3), $(=Max(Year)-4)}, sales = {"&amp;gt;0"}&amp;gt;}sales)&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Oct 2018 13:08:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-Average-but-ignore-zero/m-p/91179#M751988</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-10-30T13:08:31Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Average but ignore zero</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-Average-but-ignore-zero/m-p/91180#M751989</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Chris, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following expression also should works:&lt;/P&gt;&lt;P&gt;Avg({&amp;lt;Year = {"&amp;gt;=$(=max(Year)-4)"}, sales = {"&amp;gt;0"}&amp;gt;}sales)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Vitalii&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Oct 2018 13:29:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-Average-but-ignore-zero/m-p/91180#M751989</guid>
      <dc:creator>vitaliichupryna</dc:creator>
      <dc:date>2018-10-30T13:29:28Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Average but ignore zero</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-Average-but-ignore-zero/m-p/91181#M751990</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thats great, thanks Sunny, i have used the first solution you gave. the second one gave different results in my real data to the first for some reason. &lt;/P&gt;&lt;P&gt;Thanks for your help. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Oct 2018 13:34:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-Average-but-ignore-zero/m-p/91181#M751990</guid>
      <dc:creator>hopkinsc</dc:creator>
      <dc:date>2018-10-30T13:34:22Z</dc:date>
    </item>
  </channel>
</rss>

