<?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 Idea required - week between years in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Idea-required-week-between-years/m-p/541122#M202262</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am just trying to think of an idea to capture that "week_between_the_years" that we had this/last year and that we're having again next/this year:&lt;/P&gt;&lt;P&gt;- A part of the week is in Dec. of one year, in week 52&lt;/P&gt;&lt;P&gt;- A part of the week is in Jan. of the following year, in week 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just thought I'd share the way I have devised of doing this, maybe someone can come up with a better one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have so far devised a way of capturing that case, but I realize that it does only half the job:&lt;/P&gt;&lt;P&gt;- By using &lt;STRONG&gt;year(weekstart(today(), -1)) &lt;/STRONG&gt;and &lt;STRONG&gt;week(weekstart(today, -1)), &lt;/STRONG&gt;I can determine that the start of that week is not in this year, but in the last and that the nr. of that week is not (2-1), but 52.&lt;/P&gt;&lt;P&gt;&amp;lt;=&amp;gt; However, if I build that into a set_expression, because of the year_selection, it captures only those days which were effectively in the same &lt;STRONG&gt;year&lt;/STRONG&gt; and &lt;STRONG&gt;week&lt;/STRONG&gt; as the start of the week - so, taking last/this year as an example, it would have captured only Mo and Tue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=&amp;gt; Easy enough, the remaining days could be captured by using &lt;STRONG&gt;year(weekend(today(), -1)) &lt;/STRONG&gt;and &lt;STRONG&gt;week(weekend(today, -1))&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;=&amp;gt; That would make the set_expression really complex as you'd have to actually use two different ones and build them into an&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF_construct querying first if &lt;STRONG&gt;weekstart &lt;/STRONG&gt;is in a different year than &lt;STRONG&gt;weekend&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=&amp;gt; This is, however, the best I can think of.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If someone has a better idea, please share it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DataNibbler&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 21 Jan 2014 08:41:08 GMT</pubDate>
    <dc:creator>datanibbler</dc:creator>
    <dc:date>2014-01-21T08:41:08Z</dc:date>
    <item>
      <title>Idea required - week between years</title>
      <link>https://community.qlik.com/t5/QlikView/Idea-required-week-between-years/m-p/541122#M202262</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am just trying to think of an idea to capture that "week_between_the_years" that we had this/last year and that we're having again next/this year:&lt;/P&gt;&lt;P&gt;- A part of the week is in Dec. of one year, in week 52&lt;/P&gt;&lt;P&gt;- A part of the week is in Jan. of the following year, in week 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just thought I'd share the way I have devised of doing this, maybe someone can come up with a better one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have so far devised a way of capturing that case, but I realize that it does only half the job:&lt;/P&gt;&lt;P&gt;- By using &lt;STRONG&gt;year(weekstart(today(), -1)) &lt;/STRONG&gt;and &lt;STRONG&gt;week(weekstart(today, -1)), &lt;/STRONG&gt;I can determine that the start of that week is not in this year, but in the last and that the nr. of that week is not (2-1), but 52.&lt;/P&gt;&lt;P&gt;&amp;lt;=&amp;gt; However, if I build that into a set_expression, because of the year_selection, it captures only those days which were effectively in the same &lt;STRONG&gt;year&lt;/STRONG&gt; and &lt;STRONG&gt;week&lt;/STRONG&gt; as the start of the week - so, taking last/this year as an example, it would have captured only Mo and Tue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=&amp;gt; Easy enough, the remaining days could be captured by using &lt;STRONG&gt;year(weekend(today(), -1)) &lt;/STRONG&gt;and &lt;STRONG&gt;week(weekend(today, -1))&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;=&amp;gt; That would make the set_expression really complex as you'd have to actually use two different ones and build them into an&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF_construct querying first if &lt;STRONG&gt;weekstart &lt;/STRONG&gt;is in a different year than &lt;STRONG&gt;weekend&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=&amp;gt; This is, however, the best I can think of.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If someone has a better idea, please share it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DataNibbler&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Jan 2014 08:41:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Idea-required-week-between-years/m-p/541122#M202262</guid>
      <dc:creator>datanibbler</dc:creator>
      <dc:date>2014-01-21T08:41:08Z</dc:date>
    </item>
  </channel>
</rss>

