<?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 Use if function in Sum in expression in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Use-if-function-in-Sum-in-expression/m-p/241395#M91820</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This could be a solution, but I also want to know how to solve it with the if function as I described&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 07 Mar 2011 22:35:04 GMT</pubDate>
    <dc:creator />
    <dc:date>2011-03-07T22:35:04Z</dc:date>
    <item>
      <title>Use if function in Sum in expression</title>
      <link>https://community.qlik.com/t5/QlikView/Use-if-function-in-Sum-in-expression/m-p/241393#M91818</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In a table i have the next values (among others of course),&lt;/P&gt;&lt;P&gt;Year, StartWeek, EndWeek&lt;/P&gt;&lt;P&gt;I want to calc the period in weeks between the start and and week. I have the next formule which works fine for records with the start en the end week in the same year.&lt;/P&gt;&lt;P&gt;SUM({&amp;lt;Source={Source1},Year={$ (=maxstring(Year))}&amp;gt;}[EndWeek] -[StartWeek]+1)&lt;BR /&gt;This one works fine.&lt;/P&gt;&lt;P&gt;When the start week is in one year and the end week in the other i get the next, asuming that one year is always 52 weeks&lt;/P&gt;&lt;P&gt;SUM({&amp;lt;Source={Source1},Year={$ (=maxstring(Year))}&amp;gt;}&lt;BR /&gt; If([EndWeek]-[StartWeek]&amp;lt;&amp;lt;0,&lt;BR /&gt; 52-[StartWeek]+[EndWeek]+1,&lt;BR /&gt; [EndWeek]-[StartWeek]+1&lt;BR /&gt; )&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;But this one returns strange high values.&lt;/P&gt;&lt;P&gt;Can anyone give me a help please? Thnx in advance&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Mar 2011 21:37:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Use-if-function-in-Sum-in-expression/m-p/241393#M91818</guid>
      <dc:creator />
      <dc:date>2011-03-07T21:37:16Z</dc:date>
    </item>
    <item>
      <title>Use if function in Sum in expression</title>
      <link>https://community.qlik.com/t5/QlikView/Use-if-function-in-Sum-in-expression/m-p/241394#M91819</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not 100% sure what the solution is but the problem is that your week numbers don't have years associated to them (the first week of every year is 1 instead of 1 and 53, etc.). I think you need to use the weekyear function on for the [StartWeek] and [EndWeek] fields in the script.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Mar 2011 22:29:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Use-if-function-in-Sum-in-expression/m-p/241394#M91819</guid>
      <dc:creator />
      <dc:date>2011-03-07T22:29:13Z</dc:date>
    </item>
    <item>
      <title>Use if function in Sum in expression</title>
      <link>https://community.qlik.com/t5/QlikView/Use-if-function-in-Sum-in-expression/m-p/241395#M91820</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This could be a solution, but I also want to know how to solve it with the if function as I described&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Mar 2011 22:35:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Use-if-function-in-Sum-in-expression/m-p/241395#M91820</guid>
      <dc:creator />
      <dc:date>2011-03-07T22:35:04Z</dc:date>
    </item>
    <item>
      <title>Use if function in Sum in expression</title>
      <link>https://community.qlik.com/t5/QlikView/Use-if-function-in-Sum-in-expression/m-p/241396#M91821</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ignore my last suggestion I was confused by the reference manual. I'm pretty sure that's still what you want to do but I'm not sure which function to use or anything like that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Mar 2011 22:45:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Use-if-function-in-Sum-in-expression/m-p/241396#M91821</guid>
      <dc:creator />
      <dc:date>2011-03-07T22:45:39Z</dc:date>
    </item>
    <item>
      <title>Use if function in Sum in expression</title>
      <link>https://community.qlik.com/t5/QlikView/Use-if-function-in-Sum-in-expression/m-p/241397#M91822</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Someone else a hint, I'm a bit stuck with this problem&lt;IMG alt="Confused" src="http://community.qlik.com/emoticons/emotion-42.gif" /&gt;. Thnx in advance !&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Mar 2011 09:40:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Use-if-function-in-Sum-in-expression/m-p/241397#M91822</guid>
      <dc:creator />
      <dc:date>2011-03-08T09:40:52Z</dc:date>
    </item>
    <item>
      <title>Use if function in Sum in expression</title>
      <link>https://community.qlik.com/t5/QlikView/Use-if-function-in-Sum-in-expression/m-p/241398#M91823</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;My guess is you have "Week" as dimension (field) with possible values from 1 to 52 (or 53). When the chart displays more than one year -say 2010 and 2011-, it accumulates the Week number, meaning that when you see at Week 2 the chart is aggregating values from week 2 in year 2011 and year 2010. So I'd create a new field in your master calendar like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;WeekName(YourDateField) AS WeekName&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Then the expressión should work without conditional, using this new field as dimension, instead of "Week".&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Mar 2011 10:27:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Use-if-function-in-Sum-in-expression/m-p/241398#M91823</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2011-03-08T10:27:37Z</dc:date>
    </item>
    <item>
      <title>AW:Re: Use if function in Sum in expression</title>
      <link>https://community.qlik.com/t5/QlikView/Use-if-function-in-Sum-in-expression/m-p/241399#M91824</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am sure that you can't use your expression in the way you do. According to what Miguel said: If you do not differentiate your weeks (belonging to exactly one year) it won't work correctly. Examp:&lt;/P&gt;&lt;P&gt;- the result of your expression is for "05-2010" and "06-2011" the same as for "05-2010" and "06-2010". First should be 53!!&lt;/P&gt;&lt;P&gt;Regards, Roland&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Mar 2011 10:40:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Use-if-function-in-Sum-in-expression/m-p/241399#M91824</guid>
      <dc:creator />
      <dc:date>2011-03-08T10:40:18Z</dc:date>
    </item>
  </channel>
</rss>

