<?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: Row iteration counter in Qlik Sense with condition in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Row-iteration-counter-in-Qlik-Sense-with-condition/m-p/1920007#M75729</link>
    <description>&lt;P&gt;Hi Bepriba,&lt;/P&gt;
&lt;P&gt;you could try something like this in your load script,:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;//Counting Occurrence of each Condition for each ID
tmp:
Load
ID,
CONDITION,
Count(CONDITION) as CountCondition
From....
Group by ID, Condition;

//Using IterNo() to increase Count by 1 and generating new dataset for each occurrence
Final:
Load
ID,
CONDITION,
IterNo() as COUNTER
Resident tmp
while IterNo() &amp;lt;= CountCondition;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let me know if it helped.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Can&lt;/P&gt;</description>
    <pubDate>Tue, 19 Apr 2022 14:58:58 GMT</pubDate>
    <dc:creator>canerkan</dc:creator>
    <dc:date>2022-04-19T14:58:58Z</dc:date>
    <item>
      <title>Row iteration counter in Qlik Sense with condition</title>
      <link>https://community.qlik.com/t5/App-Development/Row-iteration-counter-in-Qlik-Sense-with-condition/m-p/1919978#M75723</link>
      <description>&lt;P&gt;Hi, I would need to implement a row iteration counter but with conditions. I've tried using AutoNumber() but it doesn't seem to really work.&lt;/P&gt;
&lt;P&gt;This is the data that I have :&lt;/P&gt;
&lt;TABLE style="border-style: double;" border="1" width="177.33333333333334px"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="87.6719px" height="25px"&gt;&lt;STRONG&gt;ID&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="88.6562px" height="25px"&gt;&lt;STRONG&gt;CONDITION&lt;/STRONG&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="87.6719px" height="25px"&gt;ABC123&lt;/TD&gt;
&lt;TD width="88.6562px" height="25px"&gt;TRUE&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="87.6719px" height="25px"&gt;ABC123&lt;/TD&gt;
&lt;TD width="88.6562px" height="25px"&gt;FALSE&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="87.6719px" height="25px"&gt;ABC456&lt;/TD&gt;
&lt;TD width="88.6562px" height="25px"&gt;TRUE&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="87.6719px" height="25px"&gt;ABC456&lt;/TD&gt;
&lt;TD width="88.6562px" height="25px"&gt;TRUE&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="87.6719px" height="25px"&gt;ABC456&lt;/TD&gt;
&lt;TD width="88.6562px" height="25px"&gt;FALSE&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="87.6719px" height="25px"&gt;ABC456&lt;/TD&gt;
&lt;TD width="88.6562px" height="25px"&gt;FALSE&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="87.6719px" height="25px"&gt;ABC789&lt;/TD&gt;
&lt;TD width="88.6562px" height="25px"&gt;TRUE&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="87.6719px" height="25px"&gt;ABC789&lt;/TD&gt;
&lt;TD width="88.6562px" height="25px"&gt;TRUE&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="87.6719px" height="25px"&gt;ABC789&lt;/TD&gt;
&lt;TD width="88.6562px" height="25px"&gt;TRUE&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="87.6719px" height="25px"&gt;ABC789&lt;/TD&gt;
&lt;TD width="88.6562px" height="25px"&gt;FALSE&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="87.6719px" height="25px"&gt;ABC789&lt;/TD&gt;
&lt;TD width="88.6562px" height="25px"&gt;FALSE&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="87.6719px" height="25px"&gt;ABC789&lt;/TD&gt;
&lt;TD width="88.6562px" height="25px"&gt;FALSE&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wanted to achieve something like this :&lt;/P&gt;
&lt;TABLE style="border-style: double;" border="1"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;&lt;STRONG&gt;ID&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;&lt;STRONG&gt;CONDITION&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;&lt;STRONG&gt;COUNTER&lt;/STRONG&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;ABC123&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;TRUE&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;ABC123&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;FALSE&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;ABC456&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;TRUE&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;ABC456&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;TRUE&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;ABC456&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;FALSE&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;ABC456&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;FALSE&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;ABC789&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;TRUE&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;ABC789&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;TRUE&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;ABC789&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;TRUE&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;ABC789&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;FALSE&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;ABC789&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;FALSE&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;ABC789&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;FALSE&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;3&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help is appreciated!&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 14:27:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Row-iteration-counter-in-Qlik-Sense-with-condition/m-p/1919978#M75723</guid>
      <dc:creator>bepriba</dc:creator>
      <dc:date>2022-04-19T14:27:43Z</dc:date>
    </item>
    <item>
      <title>Re: Row iteration counter in Qlik Sense with condition</title>
      <link>https://community.qlik.com/t5/App-Development/Row-iteration-counter-in-Qlik-Sense-with-condition/m-p/1919995#M75725</link>
      <description>&lt;P&gt;Maybe with interrecord-functions and something like this:&lt;/P&gt;
&lt;P&gt;t1: load *, ID &amp;amp; '|' &amp;amp; CONDITION as KEY, recno() as RECNO from SOURCE;&lt;/P&gt;
&lt;P&gt;t2: load *, if(KEY = previous(KEY), peek('COUNTER') + 1, 1) as COUNTER&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;resident t1 order by ID, RECNO;&lt;/P&gt;
&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 14:45:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Row-iteration-counter-in-Qlik-Sense-with-condition/m-p/1919995#M75725</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2022-04-19T14:45:58Z</dc:date>
    </item>
    <item>
      <title>Re: Row iteration counter in Qlik Sense with condition</title>
      <link>https://community.qlik.com/t5/App-Development/Row-iteration-counter-in-Qlik-Sense-with-condition/m-p/1920007#M75729</link>
      <description>&lt;P&gt;Hi Bepriba,&lt;/P&gt;
&lt;P&gt;you could try something like this in your load script,:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;//Counting Occurrence of each Condition for each ID
tmp:
Load
ID,
CONDITION,
Count(CONDITION) as CountCondition
From....
Group by ID, Condition;

//Using IterNo() to increase Count by 1 and generating new dataset for each occurrence
Final:
Load
ID,
CONDITION,
IterNo() as COUNTER
Resident tmp
while IterNo() &amp;lt;= CountCondition;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let me know if it helped.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Can&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 14:58:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Row-iteration-counter-in-Qlik-Sense-with-condition/m-p/1920007#M75729</guid>
      <dc:creator>canerkan</dc:creator>
      <dc:date>2022-04-19T14:58:58Z</dc:date>
    </item>
    <item>
      <title>Re: Row iteration counter in Qlik Sense with condition</title>
      <link>https://community.qlik.com/t5/App-Development/Row-iteration-counter-in-Qlik-Sense-with-condition/m-p/1920034#M75733</link>
      <description>&lt;P&gt;Hi Marcus,&lt;/P&gt;
&lt;P&gt;Thanks a lot, this worked like a charm with a slight adjustment :&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;I used &lt;STRONG&gt;order by KEY&lt;/STRONG&gt; instead of &lt;STRONG&gt;order by ID, RECNO&lt;/STRONG&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 15:41:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Row-iteration-counter-in-Qlik-Sense-with-condition/m-p/1920034#M75733</guid>
      <dc:creator>bepriba</dc:creator>
      <dc:date>2022-04-19T15:41:09Z</dc:date>
    </item>
  </channel>
</rss>

