<?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: Negative Weeks in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Negative-Weeks/m-p/582531#M477980</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Isabel&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could try using the mod(int1,int2) function in your formulae. It returns the modulus of two integers, ie the remainder when you divide int2 by int1. It also works for negative numbers:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;=&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;mod&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(-2,52) &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;returns "50"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Erica&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 07 Apr 2014 12:49:41 GMT</pubDate>
    <dc:creator />
    <dc:date>2014-04-07T12:49:41Z</dc:date>
    <item>
      <title>Negative Weeks</title>
      <link>https://community.qlik.com/t5/QlikView/Negative-Weeks/m-p/582529#M477978</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I was wondering how I go about subtracting weeks so that I do not result in a negative week. For example, if it is currently week 12 and I am subtracting 13 weeks, I do not get a value. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried to determine the POS Net Sales for 13 weeks from the Current week using Set Analysis:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SUM({$&amp;lt;Year={$(=Max(Year))},&lt;/P&gt;&lt;P&gt;&amp;nbsp; Week=($(=(vCurrentWeek)-13))},&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;SKU=P(SKU)&amp;gt;} [POS Net Units])&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;However, I need to somehow incorporate the following if statement:&lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;if($(=(vCurrentWeek)-13)&amp;lt;0, Week=$(=(vCurrentWeek)-13)+52) &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Any help would be greatly appreciated! I am trying to make it uniform so that if I subtract say 14, or 15 weeks, it will also work. &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 Mar 2014 19:07:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Negative-Weeks/m-p/582529#M477978</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-03-31T19:07:58Z</dc:date>
    </item>
    <item>
      <title>Re: Negative Weeks</title>
      <link>https://community.qlik.com/t5/QlikView/Negative-Weeks/m-p/582530#M477979</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The usual solution is to create a serial week field in the script and use that field instead. By serial week field I mean a field with values where every weeks value is 1 larger than the previous weeks value. Something like &lt;EM&gt;autonumber(Year*100+Week,'_WeekCounter') as _WeekSerial&lt;/EM&gt;. If you have a date field you can use the &lt;A _jive_internal="true" href="https://community.qlik.com/thread/40043"&gt;Qlikview Components script library&lt;/A&gt; to create a Calendar table from that date field and you'll get the _WeekSerial field in that table too. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 Mar 2014 19:22:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Negative-Weeks/m-p/582530#M477979</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2014-03-31T19:22:27Z</dc:date>
    </item>
    <item>
      <title>Re: Negative Weeks</title>
      <link>https://community.qlik.com/t5/QlikView/Negative-Weeks/m-p/582531#M477980</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Isabel&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could try using the mod(int1,int2) function in your formulae. It returns the modulus of two integers, ie the remainder when you divide int2 by int1. It also works for negative numbers:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;=&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;mod&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(-2,52) &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;returns "50"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Erica&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Apr 2014 12:49:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Negative-Weeks/m-p/582531#M477980</guid>
      <dc:creator />
      <dc:date>2014-04-07T12:49:41Z</dc:date>
    </item>
  </channel>
</rss>

