<?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 Dynamic periods in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Dynamic-periods/m-p/226619#M78798</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot, It seems to work just perfect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 Apr 2010 07:51:19 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-04-29T07:51:19Z</dc:date>
    <item>
      <title>Dynamic periods</title>
      <link>https://community.qlik.com/t5/QlikView/Dynamic-periods/m-p/226617#M78796</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm facing some difficulties in creating dynamic period. I like to aggregate data in 30 days periods for a specific customer, and I'd like to create a period number for that customer. As an example look at the data structure below. The first period for one specific customer starts with his first appearance. All appearances for that customer withion 30 days is in period 1. Period 2 for that customer should start with his first appearance without his first 30 days period, so that period might start 31 days from the first as well as 300 days from the first&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 149pt; border-collapse: collapse;" width="199"&gt;&lt;COLGROUP&gt;&lt;COL style="width: 48pt;" width="64" /&gt;&lt;COL style="width: 53pt; mso-width-source: userset; mso-width-alt: 2596;" width="71" /&gt;&lt;COL style="width: 48pt;" width="64" /&gt;&lt;/COLGROUP&gt;&lt;TBODY&gt;&lt;TR height="17" style="height: 12.75pt;"&gt;&lt;TD class="xl24" height="17" style="width: 48pt; height: 12.75pt; background-color: transparent; border: #ece9d8;" width="64"&gt;Id&lt;/TD&gt;&lt;TD class="xl24" style="width: 53pt; background-color: transparent; border: #ece9d8;" width="71"&gt;Date&lt;/TD&gt;&lt;TD class="xl24" style="width: 48pt; background-color: transparent; border: #ece9d8;" width="64"&gt;Period&lt;/TD&gt;&lt;/TR&gt;&lt;TR height="17" style="height: 12.75pt;"&gt;&lt;TD class="xl24" height="17" style="height: 12.75pt; background-color: transparent; border: #ece9d8;"&gt;1&lt;/TD&gt;&lt;TD class="xl25" style="background-color: transparent; border: #ece9d8;" num="39508"&gt;2008-03-01&lt;/TD&gt;&lt;TD class="xl24" style="background-color: transparent; border: #ece9d8;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR height="17" style="height: 12.75pt;"&gt;&lt;TD class="xl24" height="17" style="height: 12.75pt; background-color: transparent; border: #ece9d8;"&gt;1&lt;/TD&gt;&lt;TD class="xl25" style="background-color: transparent; border: #ece9d8;" num="39511"&gt;2008-03-04&lt;/TD&gt;&lt;TD class="xl24" style="background-color: transparent; border: #ece9d8;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR height="17" style="height: 12.75pt;"&gt;&lt;TD class="xl24" height="17" style="height: 12.75pt; background-color: transparent; border: #ece9d8;"&gt;1&lt;/TD&gt;&lt;TD class="xl25" style="background-color: transparent; border: #ece9d8;" num="39827"&gt;2009-01-14&lt;/TD&gt;&lt;TD class="xl24" style="background-color: transparent; border: #ece9d8;"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR height="17" style="height: 12.75pt;"&gt;&lt;TD class="xl24" height="17" style="height: 12.75pt; background-color: transparent; border: #ece9d8;"&gt;1&lt;/TD&gt;&lt;TD class="xl25" style="background-color: transparent; border: #ece9d8;" num="39887"&gt;2009-03-15&lt;/TD&gt;&lt;TD class="xl24" style="background-color: transparent; border: #ece9d8;"&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR height="17" style="height: 12.75pt;"&gt;&lt;TD class="xl24" height="17" style="height: 12.75pt; background-color: transparent; border: #ece9d8;"&gt;2&lt;/TD&gt;&lt;TD class="xl25" style="background-color: transparent; border: #ece9d8;" num="39827"&gt;2009-01-14&lt;/TD&gt;&lt;TD class="xl24" style="background-color: transparent; border: #ece9d8;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR height="17" style="height: 12.75pt;"&gt;&lt;TD class="xl24" height="17" style="height: 12.75pt; background-color: transparent; border: #ece9d8;"&gt;2&lt;/TD&gt;&lt;TD class="xl25" style="background-color: transparent; border: #ece9d8;" num="39828"&gt;2009-01-15&lt;/TD&gt;&lt;TD class="xl24" style="background-color: transparent; border: #ece9d8;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR height="17" style="height: 12.75pt;"&gt;&lt;TD class="xl24" height="17" style="height: 12.75pt; background-color: transparent; border: #ece9d8;"&gt;2&lt;/TD&gt;&lt;TD class="xl25" style="background-color: transparent; border: #ece9d8;" num="39829"&gt;2009-01-16&lt;/TD&gt;&lt;TD class="xl24" style="background-color: transparent; border: #ece9d8;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR height="17" style="height: 12.75pt;"&gt;&lt;TD class="xl24" height="17" style="height: 12.75pt; background-color: transparent; border: #ece9d8;"&gt;2&lt;/TD&gt;&lt;TD class="xl25" style="background-color: transparent; border: #ece9d8;" num="39830"&gt;2009-01-17&lt;/TD&gt;&lt;TD class="xl24" style="background-color: transparent; border: #ece9d8;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR height="17" style="height: 12.75pt;"&gt;&lt;TD class="xl24" height="17" style="height: 12.75pt; background-color: transparent; border: #ece9d8;"&gt;2&lt;/TD&gt;&lt;TD class="xl25" style="background-color: transparent; border: #ece9d8;" num="39831"&gt;2009-01-18&lt;/TD&gt;&lt;TD class="xl24" style="background-color: transparent; border: #ece9d8;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR height="17" style="height: 12.75pt;"&gt;&lt;TD class="xl24" height="17" style="height: 12.75pt; background-color: transparent; border: #ece9d8;"&gt;2&lt;/TD&gt;&lt;TD class="xl25" style="background-color: transparent; border: #ece9d8;" num="39832"&gt;2009-01-19&lt;/TD&gt;&lt;TD class="xl24" style="background-color: transparent; border: #ece9d8;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR height="17" style="height: 12.75pt;"&gt;&lt;TD class="xl24" height="17" style="height: 12.75pt; background-color: transparent; border: #ece9d8;"&gt;2&lt;/TD&gt;&lt;TD class="xl25" style="background-color: transparent; border: #ece9d8;" num="39833"&gt;2009-01-20&lt;/TD&gt;&lt;TD class="xl24" style="background-color: transparent; border: #ece9d8;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR height="17" style="height: 12.75pt;"&gt;&lt;TD class="xl24" height="17" style="height: 12.75pt; background-color: transparent; border: #ece9d8;"&gt;2&lt;/TD&gt;&lt;TD class="xl25" style="background-color: transparent; border: #ece9d8;" num="39834"&gt;2009-01-21&lt;/TD&gt;&lt;TD class="xl24" style="background-color: transparent; border: #ece9d8;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone have a solution to this problem, please let me know!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Apr 2010 12:31:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dynamic-periods/m-p/226617#M78796</guid>
      <dc:creator />
      <dc:date>2010-04-28T12:31:46Z</dc:date>
    </item>
    <item>
      <title>Dynamic periods</title>
      <link>https://community.qlik.com/t5/QlikView/Dynamic-periods/m-p/226618#M78797</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This seems to do the trick:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;,if(Id&amp;lt;&amp;gt;previous(Id) or Date-peek(PeriodStart)&amp;gt;30,Date,peek(PeriodStart)) as PeriodStart&lt;BR /&gt;,if(Id&amp;lt;&amp;gt;previous(Id),1,peek(Period)-(Date-peek(PeriodStart)&amp;gt;30)) as Period&lt;/P&gt;&lt;P&gt;It probably needs a little explanation, though. Previous() looks at the previous record in the SOURCE table. Peek() looks at the previous record in the table you are currently creating. Conditions evaluate to -1 for true, 0 for false, so when I subtract (Date-peek(PeriodStart)&amp;gt;30), this is shorthand for adding if(Date-peek(PeriodStart)&amp;gt;30,1,0).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Apr 2010 21:21:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dynamic-periods/m-p/226618#M78797</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2010-04-28T21:21:29Z</dc:date>
    </item>
    <item>
      <title>Dynamic periods</title>
      <link>https://community.qlik.com/t5/QlikView/Dynamic-periods/m-p/226619#M78798</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot, It seems to work just perfect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Apr 2010 07:51:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dynamic-periods/m-p/226619#M78798</guid>
      <dc:creator />
      <dc:date>2010-04-29T07:51:19Z</dc:date>
    </item>
  </channel>
</rss>

