<?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: Creating a sequence counter in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Creating-a-sequence-counter/m-p/1807599#M65737</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/141264"&gt;@seraphis&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;tmp:&lt;/P&gt;&lt;P&gt;load&amp;nbsp;&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;From xxx;&lt;/P&gt;&lt;P&gt;noconcatenate tmp2: load * resident tmp order by "Asset Serial"; drop table tmp;&lt;/P&gt;&lt;P&gt;tmp3:&lt;/P&gt;&lt;P&gt;Load *,&lt;/P&gt;&lt;P&gt;"Asset Serial" = Previous("Asset Serial") * (-1) as AssetCountFlag&lt;/P&gt;&lt;P&gt;resident tmp2;&lt;/P&gt;&lt;P&gt;drop table tmp2;&lt;/P&gt;&lt;P&gt;br&lt;/P&gt;&lt;P&gt;m&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 13 May 2021 06:58:35 GMT</pubDate>
    <dc:creator>mato32188</dc:creator>
    <dc:date>2021-05-13T06:58:35Z</dc:date>
    <item>
      <title>Creating a sequence counter</title>
      <link>https://community.qlik.com/t5/App-Development/Creating-a-sequence-counter/m-p/1807263#M65701</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I have fields AssetSerialNumber (points to the product serial number the customer has), CaseCreatedDate, CaseNumber,etc.&lt;/P&gt;&lt;P&gt;I need to have a report that has a new field named "Repeat_Caller_Flag" that says 1 if the AssetSerialNumber is repeated more than once in the table. However, the first instance should always be marked 0 and after the first instance if there are more then they should be all be marked as 1.&lt;/P&gt;&lt;P&gt;I have this code below but it is taking painfully long to execute. Can someone suggest a better option?&lt;/P&gt;&lt;P&gt;Seq:&lt;/P&gt;&lt;P&gt;load *,&lt;BR /&gt;If("Case Asset Serial Number"=Previous("Case Asset Serial Number")&lt;BR /&gt;If("Case Asset Serial Number"=Previous("Case Asset Serial Number"),Peek(Repete_Seq)+1,1) as Repete_Seq&lt;BR /&gt;Resident Case order by "Case Asset Serial Number",[Case Created Timestamp] desc;&lt;/P&gt;&lt;P&gt;drop table Case;&lt;/P&gt;&lt;P&gt;NoConcatenate&lt;/P&gt;&lt;P&gt;Seq_1:&lt;/P&gt;&lt;P&gt;load "Case Asset Serial Number",if(max(Repete_Seq)&amp;gt;1,1,0) as Repeate_Caller_Flag&amp;nbsp; resident Seq group by "Case Asset Serial Number";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Dec 2021 21:56:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Creating-a-sequence-counter/m-p/1807263#M65701</guid>
      <dc:creator>seraphis</dc:creator>
      <dc:date>2021-12-21T21:56:36Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a sequence counter</title>
      <link>https://community.qlik.com/t5/App-Development/Creating-a-sequence-counter/m-p/1807378#M65711</link>
      <description>&lt;P&gt;If you are only doing the PREVIOUS/PEEK to create the counter, but don't really need that field for the end user you could simply do something like this and skip your code:&lt;/P&gt;&lt;P&gt;Numbers:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Load&amp;nbsp;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;SPAN&gt;"Case Asset Serial Number",&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;SPAN&gt;IF (AssetCount = 1, 'Single', 'Multiple') as AssetCountFlag;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;SPAN&gt;"Case Asset Serial Number",&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;SPAN&gt;Count("Case Asset Serial Number") as AssetCount&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;Resident Case&amp;nbsp;&lt;/P&gt;&lt;P&gt;Group by&amp;nbsp;&lt;SPAN&gt;"Case Asset Serial Number";&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Alternatively you could simply do an IF when doing the count to say Single/Multiple if you don't actually want to keep the count as a field. I did preceding load to give you the flag and the count.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 May 2021 14:18:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Creating-a-sequence-counter/m-p/1807378#M65711</guid>
      <dc:creator>Dalton_Ruer</dc:creator>
      <dc:date>2021-05-12T14:18:56Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a sequence counter</title>
      <link>https://community.qlik.com/t5/App-Development/Creating-a-sequence-counter/m-p/1807579#M65734</link>
      <description>&lt;P&gt;Hi, thanks for the code. However, it is still not giving me the first instance of the asset serial number as 0. I have replaced 'Single' and 'Multiple' with 0 and 1 below. The serial number that is present only once should show 0 but the first instance of the serial number that is present multiple times should also show 0 (the remaining ones,after the first instance, should show 1). I could arrange the serial numbers by ascending or descending order of case creation.&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I want&lt;/P&gt;&lt;P&gt;Asset Serial&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AssetCountFlag&lt;/P&gt;&lt;P&gt;ASD5679&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;BR /&gt;ASD5679&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;BR /&gt;ASD5679&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;BR /&gt;ASD5679&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;BR /&gt;ASD5679&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;BR /&gt;GHJ8900&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;BR /&gt;ERT6781&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 May 2021 05:30:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Creating-a-sequence-counter/m-p/1807579#M65734</guid>
      <dc:creator>seraphis</dc:creator>
      <dc:date>2021-05-13T05:30:59Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a sequence counter</title>
      <link>https://community.qlik.com/t5/App-Development/Creating-a-sequence-counter/m-p/1807580#M65735</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;if([Asset Serial]= peek([Asset Serial]),1,0) as AssetCountFlag&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note: This would work only when your data is sorted on this field&lt;/P&gt;</description>
      <pubDate>Thu, 13 May 2021 05:46:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Creating-a-sequence-counter/m-p/1807580#M65735</guid>
      <dc:creator>tresB</dc:creator>
      <dc:date>2021-05-13T05:46:49Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a sequence counter</title>
      <link>https://community.qlik.com/t5/App-Development/Creating-a-sequence-counter/m-p/1807599#M65737</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/141264"&gt;@seraphis&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;tmp:&lt;/P&gt;&lt;P&gt;load&amp;nbsp;&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;From xxx;&lt;/P&gt;&lt;P&gt;noconcatenate tmp2: load * resident tmp order by "Asset Serial"; drop table tmp;&lt;/P&gt;&lt;P&gt;tmp3:&lt;/P&gt;&lt;P&gt;Load *,&lt;/P&gt;&lt;P&gt;"Asset Serial" = Previous("Asset Serial") * (-1) as AssetCountFlag&lt;/P&gt;&lt;P&gt;resident tmp2;&lt;/P&gt;&lt;P&gt;drop table tmp2;&lt;/P&gt;&lt;P&gt;br&lt;/P&gt;&lt;P&gt;m&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 May 2021 06:58:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Creating-a-sequence-counter/m-p/1807599#M65737</guid>
      <dc:creator>mato32188</dc:creator>
      <dc:date>2021-05-13T06:58:35Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a sequence counter</title>
      <link>https://community.qlik.com/t5/App-Development/Creating-a-sequence-counter/m-p/1807615#M65738</link>
      <description>&lt;P&gt;Hi, thanks to both of you. However, I have written a code myself and I feel it is close to working but it is not working apart from giving me a synthetic key warning. I will once again show what I have and what I want.&lt;/P&gt;&lt;P&gt;I am avoiding using Peek because with the amount of data I have, it is taking a long time to execute.&lt;/P&gt;&lt;P&gt;What I currently have&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table Case1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Asset Serial&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AssetCountFlag&lt;/P&gt;&lt;P&gt;ASD5679&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;BR /&gt;ASD5679&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;BR /&gt;ASD5679&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;BR /&gt;ASD5679&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;BR /&gt;ASD5679&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;BR /&gt;GHJ8900&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;BR /&gt;ERT6781&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;BR /&gt;WER8913&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;BR /&gt;WER8913&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I want in Table Case2&lt;/P&gt;&lt;P&gt;Asset Serial&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AssetCountFlag&lt;/P&gt;&lt;P&gt;ASD5679&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;BR /&gt;ASD5679&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;BR /&gt;ASD5679&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;BR /&gt;ASD5679&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;BR /&gt;ASD5679&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;BR /&gt;GHJ8900&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;BR /&gt;ERT6781&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;BR /&gt;WER8913&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;BR /&gt;WER8913&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;&lt;P&gt;The code I have written for creating Case2 from Case1 is given below but it is giving me a synthetic key warning plus it is not working. Can anyone point out what is wrong?&lt;/P&gt;&lt;P&gt;The data is ordered by AssetSerialNumber and CaseOpenDate in ascending order. What the code should do is to check if an AssetSerialNumber is different from its previous one (it means a new asset serial begins and this asset could be in 1 row only (marked as 0) or more than 1 row (multiple occurrences so marked 1). However, even if there are multiple occurrences, the first one must be marked as 0. The code checks the previous asset and also checks if the assetcountflag is 1 (meaning it is present in other rows as well). If it is 1, it changes it to 0 (thus, the first instance, among multiple ones, becomes 0).&lt;/P&gt;&lt;P&gt;Load *,&lt;BR /&gt;if(Case_Flat_Case.Asset_Serial_Number &amp;lt;&amp;gt; Previous(Case_Flat_Case.Asset_Serial_Number)&lt;BR /&gt;and "AssetCountFlag"=1, "AssetCountFlag" = 0)&lt;BR /&gt;Resident Case1&lt;BR /&gt;order by Case_Flat_Case.Asset_Serial_Number,Case_Flat_Case.Date_Time_Opened asc;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 May 2021 08:04:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Creating-a-sequence-counter/m-p/1807615#M65738</guid>
      <dc:creator>seraphis</dc:creator>
      <dc:date>2021-05-13T08:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a sequence counter</title>
      <link>https://community.qlik.com/t5/App-Development/Creating-a-sequence-counter/m-p/1807617#M65739</link>
      <description>&lt;P&gt;Hi, thanks to both of you. However, I have written a code that is close to working but is not quite working and is giving a synthetic key error. Also, I am not too keen to use PEEK because with the kind of data I have is taking a long time.&lt;/P&gt;&lt;P&gt;What I have in Table Case1&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;AssetSerial&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AssetCountFlag&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ASD5679&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ASD5679&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ASD5679&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ASD5679&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ASD5679&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;GHJ8900&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ERT6781&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;BR /&gt;WER9045&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;BR /&gt;WER9045&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;What I want in Table Case2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;AssetSerial&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AssetCountFlag&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ASD5679&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ASD5679&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ASD5679&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ASD5679&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ASD5679&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;GHJ8900&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ERT6781&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;BR /&gt;WER9045&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;BR /&gt;WER9045&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have written this code below that checks the AssetSerialNumber with the previous AssetSerialNumber. If it is not matching, it means it is a "new" asset. If this asset is present in only one 1 row, then AssetCountFlag will be 0. If it is present in more than 1 row, then the AssetCountFlag is 1 (in all rows). However, my requirement is that the AssetCountFlag should be 0 for the first row even if that asset is present in more than 1 row. So in a nutshell, the AssetCountFlag should be 0 when 1) the asset is present in only one row 2) the first row of the asset even when it is present in multiple rows. In all the next rows, this flag needs to show 1 (I already have this and only the first instance is a problem). The code below is giving me a synthetic key warning and does not seem to work. Can anyone please point out and correct it?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Load *,&lt;BR /&gt;if(Case_Flat_Case.Asset_Serial_Number &amp;lt;&amp;gt; Previous(Case_Flat_Case.Asset_Serial_Number)&lt;BR /&gt;and "AssetCountFlag"=1, "AssetCountFlag" = 0)&lt;BR /&gt;Resident Case1&lt;BR /&gt;order by Case_Flat_Case.Asset_Serial_Number,Case_Flat_Case.Date_Time_Opened asc;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 May 2021 08:17:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Creating-a-sequence-counter/m-p/1807617#M65739</guid>
      <dc:creator>seraphis</dc:creator>
      <dc:date>2021-05-13T08:17:02Z</dc:date>
    </item>
  </channel>
</rss>

