<?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 How to select a non-standard week in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-select-a-non-standard-week/m-p/377059#M140592</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We have a user request to look at a "weeks" worth of data but defining a week as &lt;STRONG style="text-decoration: underline;"&gt;A “Week” is considered Sunday @ 5:00:00am to next Sunday @ 04:59:59am.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We have a timestamp field "PROCESSED DATE" that shows the date and time of each transaction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I handle this?&amp;nbsp; I know that if they wanted the regular calendar week it would be easy enough, but how can I tell Qlikview to go from 7/29/2012 5:00:00 AM to 8/4/2012 4:59:59am?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Aug 2012 16:22:25 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-08-10T16:22:25Z</dc:date>
    <item>
      <title>How to select a non-standard week</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-select-a-non-standard-week/m-p/377059#M140592</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We have a user request to look at a "weeks" worth of data but defining a week as &lt;STRONG style="text-decoration: underline;"&gt;A “Week” is considered Sunday @ 5:00:00am to next Sunday @ 04:59:59am.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We have a timestamp field "PROCESSED DATE" that shows the date and time of each transaction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I handle this?&amp;nbsp; I know that if they wanted the regular calendar week it would be easy enough, but how can I tell Qlikview to go from 7/29/2012 5:00:00 AM to 8/4/2012 4:59:59am?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Aug 2012 16:22:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-select-a-non-standard-week/m-p/377059#M140592</guid>
      <dc:creator />
      <dc:date>2012-08-10T16:22:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to select a non-standard week</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-select-a-non-standard-week/m-p/377060#M140593</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I believe you should be able to this using weekstart() function with optional shift / weekoffset arguments set.&lt;/P&gt;&lt;P&gt;Well, trying this, I couldn't get it to work, seems to me that the weekoffset doesn't really like fractions of a day&lt;/P&gt;&lt;P&gt;{maybe I am missing something here or made a silly mistake}.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But a workaround using an additional daystart() seems to work:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD *,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;weekname(Weekstart) as Weekname;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD *,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;weekday(DateTime) as Weekday, &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;timestamp(WeekStart(Daystart(DateTime,0,maketime(5)),1,-1)) as Weekstart;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Timestamp(makedate(2012)+rand()*100) as DateTime&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;AutoGenerate 1000;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This code should assign all timestamps within your required intervals a common weekstart timestamp, from which you can derive e.g. a weekname. Use this weekname (or the Weekstart timestamp) to group your records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;edit: corrected a typo&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Aug 2012 18:01:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-select-a-non-standard-week/m-p/377060#M140593</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-08-10T18:01:33Z</dc:date>
    </item>
  </channel>
</rss>

