<?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 sum if not working in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/sum-if-not-working/m-p/346092#M578530</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Was it useful for you?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 13 Mar 2012 18:44:24 GMT</pubDate>
    <dc:creator>sebastiandperei</dc:creator>
    <dc:date>2012-03-13T18:44:24Z</dc:date>
    <item>
      <title>sum if not working</title>
      <link>https://community.qlik.com/t5/QlikView/sum-if-not-working/m-p/346088#M578526</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I created a chart that displays data grouped into weeks.&amp;nbsp; The dimension is a temp calendar which shows all week starts for the next 7 weeks.&amp;nbsp; I created the temp calendar so it would show weeks with no data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See my qvw doc attached.&amp;nbsp; My expression for sum by week is: sum(if(TempMRPWeek=MRPWeek,MRPQty,0))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When summing the data my sums seem to be extremely high.&amp;nbsp; The total for week 3/5/2012 should be 130 but the chart is showing 910.&amp;nbsp; Any idea why the sum is not working correctly?&amp;nbsp; What other way should I try to sum?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Mar 2012 19:00:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sum-if-not-working/m-p/346088#M578526</guid>
      <dc:creator />
      <dc:date>2012-03-09T19:00:46Z</dc:date>
    </item>
    <item>
      <title>sum if not working</title>
      <link>https://community.qlik.com/t5/QlikView/sum-if-not-working/m-p/346089#M578527</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;Your TMP calendar repeats 7 times every date, and it causes that "sum" function add each value 7 times.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Easier solution, is to put Distinct in your expression:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum(Distinct if(TempMRPWeek=MRPWeek,MRPQty,0))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But, if you have two same values, it will take only one. Another way is, later of the script, read the Temp Calendar again, then drop the first:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;//Calendar&lt;/P&gt;&lt;P&gt;LET vDateMin = Num(WeekStart(Today()-7));&lt;/P&gt;&lt;P&gt;LET NoOfDays = 546;&lt;/P&gt;&lt;P&gt;TempCalendar:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;weekstart(date($(vDateMin) + recno() + 6)) as TempMRPWeek&lt;/P&gt;&lt;P&gt;AUTOGENERATE $(NoOfDays);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TempCal:&lt;/P&gt;&lt;P&gt;Load distinct * Resident TempCalendar;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Drop Table TempCalendar;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Mar 2012 20:23:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sum-if-not-working/m-p/346089#M578527</guid>
      <dc:creator>sebastiandperei</dc:creator>
      <dc:date>2012-03-09T20:23:50Z</dc:date>
    </item>
    <item>
      <title>Re: sum if not working</title>
      <link>https://community.qlik.com/t5/QlikView/sum-if-not-working/m-p/346090#M578528</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;See the model attach... to show weeks with no data, expand table part to this weeks joinning tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Mar 2012 20:26:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sum-if-not-working/m-p/346090#M578528</guid>
      <dc:creator>jolivares</dc:creator>
      <dc:date>2012-03-09T20:26:59Z</dc:date>
    </item>
    <item>
      <title>sum if not working</title>
      <link>https://community.qlik.com/t5/QlikView/sum-if-not-working/m-p/346091#M578529</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Based on what you've said&amp;nbsp; 910 is 7 times as much as 130.&amp;nbsp; There are duplicate entries forming for the same data(probably one for each day of the week).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But the way to solve this is adding distinct in the formula:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=sum(&lt;STRONG&gt;DISTINCT &lt;/STRONG&gt;if(TempMRPWeek=MRPWeek ,MRPQty,0))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This gives me the results I think you are looking for.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;Brandon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Mar 2012 20:30:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sum-if-not-working/m-p/346091#M578529</guid>
      <dc:creator />
      <dc:date>2012-03-09T20:30:01Z</dc:date>
    </item>
    <item>
      <title>sum if not working</title>
      <link>https://community.qlik.com/t5/QlikView/sum-if-not-working/m-p/346092#M578530</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Was it useful for you?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Mar 2012 18:44:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sum-if-not-working/m-p/346092#M578530</guid>
      <dc:creator>sebastiandperei</dc:creator>
      <dc:date>2012-03-13T18:44:24Z</dc:date>
    </item>
  </channel>
</rss>

