<?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 Autonumber period in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Autonumber-period/m-p/1646882#M447579</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to create periodIDs with the autonumber function. However, using the syntax below the master calendar returns 20+ duplicate rows (see screenshot as attached). I'm new to Qlikview and would really appreciate it if someone could help me out and tell me what is going wrong here &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have used the following syntax:&lt;/P&gt;&lt;P&gt;//--- Select the lowest and highest periods&lt;/P&gt;&lt;P&gt;Temp_Calendar_Range:&lt;BR /&gt;LOAD&lt;BR /&gt;Num(Date#(Min(Period), 'YYYYMM')) as MinDate,&lt;BR /&gt;Num(Date#(Max(Period), 'YYYYMM')) as MaxDate&lt;/P&gt;&lt;P&gt;RESIDENT [Availability];&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;//--- Assign the start and end dates to variables&lt;BR /&gt;LET vMinDate = Peek('MinDate', 0, 'Temp_Calendar_Range');&lt;BR /&gt;LET vMaxDate = Peek('MaxDate', 0, 'Temp_Calendar_Range');&lt;/P&gt;&lt;P&gt;DROP TABLE Temp_Calendar_Range; // Cleanup&lt;/P&gt;&lt;P&gt;[Master Calendar]:&lt;/P&gt;&lt;P&gt;Load *,&lt;BR /&gt;AutoNumber(Year &amp;amp; Quarter, 'QuarterID') as [QuarterID],&lt;BR /&gt;AutoNumber(Period, 'PeriodID') as [PeriodID]&lt;BR /&gt;;&lt;BR /&gt;&lt;BR /&gt;LOAD DISTINCT&lt;BR /&gt;Year(Temp_Date) * 100 + Month(Temp_Date) as [Period],&lt;BR /&gt;Year(Temp_Date) as [Year],&lt;BR /&gt;Month(Temp_Date) as [Month],&lt;BR /&gt;Date(Temp_Date, 'YYYY-MM') as [Year - Month],&lt;BR /&gt;'Q' &amp;amp; Ceil(Month(Temp_Date) / 3) as [Quarter]&lt;BR /&gt;;&lt;BR /&gt;&lt;BR /&gt;LOAD DISTINCT&lt;BR /&gt;MonthStart($(vMinDate) + IterNo() - 1) as Temp_Date&lt;BR /&gt;AUTOGENERATE (1)&lt;BR /&gt;WHILE $(vMinDate) + IterNo() - 1 &amp;lt;= $(vMaxDate);&lt;/P&gt;&lt;P&gt;//--- Remove the temporary variables&lt;BR /&gt;LET vMinDate = Null();&lt;BR /&gt;LET vMaxDate = Null();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 01:57:00 GMT</pubDate>
    <dc:creator>EsmeeM</dc:creator>
    <dc:date>2024-11-16T01:57:00Z</dc:date>
    <item>
      <title>Autonumber period</title>
      <link>https://community.qlik.com/t5/QlikView/Autonumber-period/m-p/1646882#M447579</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to create periodIDs with the autonumber function. However, using the syntax below the master calendar returns 20+ duplicate rows (see screenshot as attached). I'm new to Qlikview and would really appreciate it if someone could help me out and tell me what is going wrong here &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have used the following syntax:&lt;/P&gt;&lt;P&gt;//--- Select the lowest and highest periods&lt;/P&gt;&lt;P&gt;Temp_Calendar_Range:&lt;BR /&gt;LOAD&lt;BR /&gt;Num(Date#(Min(Period), 'YYYYMM')) as MinDate,&lt;BR /&gt;Num(Date#(Max(Period), 'YYYYMM')) as MaxDate&lt;/P&gt;&lt;P&gt;RESIDENT [Availability];&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;//--- Assign the start and end dates to variables&lt;BR /&gt;LET vMinDate = Peek('MinDate', 0, 'Temp_Calendar_Range');&lt;BR /&gt;LET vMaxDate = Peek('MaxDate', 0, 'Temp_Calendar_Range');&lt;/P&gt;&lt;P&gt;DROP TABLE Temp_Calendar_Range; // Cleanup&lt;/P&gt;&lt;P&gt;[Master Calendar]:&lt;/P&gt;&lt;P&gt;Load *,&lt;BR /&gt;AutoNumber(Year &amp;amp; Quarter, 'QuarterID') as [QuarterID],&lt;BR /&gt;AutoNumber(Period, 'PeriodID') as [PeriodID]&lt;BR /&gt;;&lt;BR /&gt;&lt;BR /&gt;LOAD DISTINCT&lt;BR /&gt;Year(Temp_Date) * 100 + Month(Temp_Date) as [Period],&lt;BR /&gt;Year(Temp_Date) as [Year],&lt;BR /&gt;Month(Temp_Date) as [Month],&lt;BR /&gt;Date(Temp_Date, 'YYYY-MM') as [Year - Month],&lt;BR /&gt;'Q' &amp;amp; Ceil(Month(Temp_Date) / 3) as [Quarter]&lt;BR /&gt;;&lt;BR /&gt;&lt;BR /&gt;LOAD DISTINCT&lt;BR /&gt;MonthStart($(vMinDate) + IterNo() - 1) as Temp_Date&lt;BR /&gt;AUTOGENERATE (1)&lt;BR /&gt;WHILE $(vMinDate) + IterNo() - 1 &amp;lt;= $(vMaxDate);&lt;/P&gt;&lt;P&gt;//--- Remove the temporary variables&lt;BR /&gt;LET vMinDate = Null();&lt;BR /&gt;LET vMaxDate = Null();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 01:57:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Autonumber-period/m-p/1646882#M447579</guid>
      <dc:creator>EsmeeM</dc:creator>
      <dc:date>2024-11-16T01:57:00Z</dc:date>
    </item>
    <item>
      <title>Re: Autonumber period</title>
      <link>https://community.qlik.com/t5/QlikView/Autonumber-period/m-p/1646886#M447580</link>
      <description>&lt;P&gt;What AutoNumber does is that if a value is repeated, it assigns it with the same value... for example everytime autonumber sees 2018Q1... it will return the same number... which is why QuarterID is always equal to 1 when Year&amp;amp;Quarter = 2018Q1 from your example.... is this not what you want?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2019 12:20:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Autonumber-period/m-p/1646886#M447580</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2019-11-14T12:20:11Z</dc:date>
    </item>
    <item>
      <title>Re: Autonumber period</title>
      <link>https://community.qlik.com/t5/QlikView/Autonumber-period/m-p/1646887#M447581</link>
      <description>&lt;P&gt;Is your Period a date field in numeric? Or in text?&lt;/P&gt;&lt;P&gt;If it is in text,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Num(Date#(Min(Period), 'YYYYMM')) as MinDate,&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Num(Date#(Max(Period), 'YYYYMM')) as MaxDate&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;The min and max here couldn't work as text field cannot be min or max.&lt;/P&gt;&lt;P&gt;Try:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Num(Min(Date#(Period, 'YYYYMM'))) as MinDate,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Num(Max(Date#(Period, 'YYYYMM'))) as MaxDate&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If your date field is in numeric,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Try:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Min(Period) as MinDate,&lt;BR /&gt;Max(Period) as MaxDate&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2019 12:22:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Autonumber-period/m-p/1646887#M447581</guid>
      <dc:creator>Arthur_Fong</dc:creator>
      <dc:date>2019-11-14T12:22:05Z</dc:date>
    </item>
    <item>
      <title>Re: Autonumber period</title>
      <link>https://community.qlik.com/t5/QlikView/Autonumber-period/m-p/1648471#M447663</link>
      <description>&lt;P&gt;Thanks for your replies!&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, my problem is that the autonumber function returns many duplicates. I have not found a solution to fix it...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a function for script that removes the duplicates from the table?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 12:11:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Autonumber-period/m-p/1648471#M447663</guid>
      <dc:creator>EsmeeM</dc:creator>
      <dc:date>2019-11-19T12:11:21Z</dc:date>
    </item>
    <item>
      <title>Re: Autonumber period</title>
      <link>https://community.qlik.com/t5/QlikView/Autonumber-period/m-p/1648485#M447664</link>
      <description>&lt;P&gt;Try:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Load *,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;AutoNumber(Quarter) as [QuarterID],&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;AutoNumber(Period) as [PeriodID]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 12:29:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Autonumber-period/m-p/1648485#M447664</guid>
      <dc:creator>Arthur_Fong</dc:creator>
      <dc:date>2019-11-19T12:29:27Z</dc:date>
    </item>
    <item>
      <title>Re: Autonumber period</title>
      <link>https://community.qlik.com/t5/QlikView/Autonumber-period/m-p/1648497#M447665</link>
      <description>&lt;P&gt;Thank you for the quick reply.&lt;/P&gt;&lt;P&gt;I tried it, but still same results...&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 12:40:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Autonumber-period/m-p/1648497#M447665</guid>
      <dc:creator>EsmeeM</dc:creator>
      <dc:date>2019-11-19T12:40:24Z</dc:date>
    </item>
    <item>
      <title>Re: Autonumber period</title>
      <link>https://community.qlik.com/t5/QlikView/Autonumber-period/m-p/1648504#M447666</link>
      <description>&lt;P&gt;&lt;SPAN&gt;LOAD DISTINCT&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Year(Temp_Date) * 100 + Month(Temp_Date) as [Period],&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Year(Temp_Date) as [Year],&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Month(Temp_Date) as [Month],&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;//Date(Temp_Date, 'YYYY-MM') as [Year - Month],&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'Q' &amp;amp; Ceil(Month(Temp_Date) / 3) as [Quarter]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Comment&amp;nbsp; Year-Month and try again.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 12:49:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Autonumber-period/m-p/1648504#M447666</guid>
      <dc:creator>Arthur_Fong</dc:creator>
      <dc:date>2019-11-19T12:49:31Z</dc:date>
    </item>
    <item>
      <title>Re: Autonumber period</title>
      <link>https://community.qlik.com/t5/QlikView/Autonumber-period/m-p/1648509#M447667</link>
      <description>&lt;P&gt;To create Year-Month field, try this:&lt;/P&gt;&lt;P&gt;Load *,Year &amp;amp;'-'&amp;amp; Month as [Year - Month];&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;LOAD DISTINCT&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Year(Temp_Date) * 100 + Month(Temp_Date) as [Period],&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Year(Temp_Date) as [Year],&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Month(Temp_Date) as [Month],&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'Q' &amp;amp; Ceil(Month(Temp_Date) / 3) as [Quarter]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 12:56:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Autonumber-period/m-p/1648509#M447667</guid>
      <dc:creator>Arthur_Fong</dc:creator>
      <dc:date>2019-11-19T12:56:44Z</dc:date>
    </item>
    <item>
      <title>Re: Autonumber period</title>
      <link>https://community.qlik.com/t5/QlikView/Autonumber-period/m-p/1648581#M447671</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Esméé, did Arthur's latest posts get you what you needed?&amp;nbsp; If so, do not forget to return to the thread and use the Accept as Solution button on the post(s) that helped you get things working properly.&amp;nbsp; If you are still working on things, leave an update for us.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Regards,&lt;BR /&gt;Brett&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 14:28:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Autonumber-period/m-p/1648581#M447671</guid>
      <dc:creator>Brett_Bleess</dc:creator>
      <dc:date>2019-11-19T14:28:24Z</dc:date>
    </item>
    <item>
      <title>Re: Autonumber period</title>
      <link>https://community.qlik.com/t5/QlikView/Autonumber-period/m-p/1648885#M447702</link>
      <description>&lt;P&gt;Thanks Arthur,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried it, but unfortunately the table still returns duplicates of rows.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 07:55:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Autonumber-period/m-p/1648885#M447702</guid>
      <dc:creator>EsmeeM</dc:creator>
      <dc:date>2019-11-20T07:55:31Z</dc:date>
    </item>
  </channel>
</rss>

