<?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: How count lines for each group separately in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-count-lines-for-each-group-separately/m-p/1518663#M598401</link>
    <description>&lt;P&gt;The second optin helps me! Thanks!&lt;/P&gt;</description>
    <pubDate>Mon, 10 Dec 2018 12:57:11 GMT</pubDate>
    <dc:creator>Ilya_Bobrov</dc:creator>
    <dc:date>2018-12-10T12:57:11Z</dc:date>
    <item>
      <title>How count lines for each group separately</title>
      <link>https://community.qlik.com/t5/QlikView/How-count-lines-for-each-group-separately/m-p/1518626#M598398</link>
      <description>&lt;P&gt;Good Day!&lt;/P&gt;&lt;P&gt;There is the task of calculating the achievement of target values for each of the reporting centers.&lt;/P&gt;&lt;P&gt;But i have problem:&amp;nbsp;&lt;/P&gt;&lt;P&gt;rowno() function count all lines like this (thats incorrest)!&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;load * inline [&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;reporting_centers&lt;/SPAN&gt;&lt;SPAN&gt;, id, targetcounter&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1,some_Uniqvalue,1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1,&lt;/SPAN&gt;&lt;SPAN&gt;some_Uniqvalue,2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1,&lt;/SPAN&gt;&lt;SPAN&gt;some_Uniqvalue,3&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2,&lt;/SPAN&gt;&lt;SPAN&gt;some_Uniqvalue,4&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2,&lt;/SPAN&gt;&lt;SPAN&gt;some_Uniqvalue,5&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3,&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;some_Uniqvalue,6&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3,&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;some_Uniqvalue,7&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3,&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;some_Uniqvalue,8&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;];&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I managed to solve the problem by breaking a single array into several separate ones, followed by writing them to different files and only after that I got the necessary cut.&lt;/P&gt;&lt;P&gt;But it seems to me that there is a simpler solution to this problem.&lt;/P&gt;&lt;P&gt;Sample of data:&lt;/P&gt;&lt;P&gt;load * inline [&lt;BR /&gt;&lt;SPAN&gt;reporting_centers&lt;/SPAN&gt;, id&lt;BR /&gt;1,some_Uniqvalue&lt;BR /&gt;1,&lt;SPAN&gt;some_Uniqvalue&lt;/SPAN&gt;&lt;BR /&gt;1,&lt;SPAN&gt;some_Uniqvalue&lt;/SPAN&gt;&lt;BR /&gt;2,&lt;SPAN&gt;some_Uniqvalue&lt;/SPAN&gt;&lt;BR /&gt;2,&lt;SPAN&gt;some_Uniqvalue&lt;/SPAN&gt;&lt;BR /&gt;3, &lt;SPAN&gt;some_Uniqvalue&lt;/SPAN&gt;&lt;BR /&gt;3, &lt;SPAN&gt;some_Uniqvalue&lt;/SPAN&gt;&lt;BR /&gt;3, &lt;SPAN&gt;some_Uniqvalue&lt;/SPAN&gt;&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;I need this result:&lt;/P&gt;&lt;P&gt;load * inline [&lt;BR /&gt;&lt;SPAN&gt;reporting&lt;/SPAN&gt;&lt;SPAN&gt;_&lt;/SPAN&gt;&lt;SPAN&gt;centers&lt;/SPAN&gt;, id, targetcounter&lt;BR /&gt;1,some_value, 1&lt;BR /&gt;1,some_value,2&lt;BR /&gt;1,some_value,3&lt;BR /&gt;2, some_value, 1&lt;BR /&gt;2, some_value, 2&lt;BR /&gt;3, some_value, 1&lt;BR /&gt;3, some_value, 2&lt;BR /&gt;3, some_value, 3&lt;BR /&gt;]; and etc (I have 21 reporting centers for a total of two million records)&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Dec 2018 12:10:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-count-lines-for-each-group-separately/m-p/1518626#M598398</guid>
      <dc:creator>Ilya_Bobrov</dc:creator>
      <dc:date>2018-12-10T12:10:21Z</dc:date>
    </item>
    <item>
      <title>Re: How count lines for each group separately</title>
      <link>https://community.qlik.com/t5/QlikView/How-count-lines-for-each-group-separately/m-p/1518631#M598399</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;You could look at this solution:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/t5/QlikView-Scripting/rank-in-script/m-p/1517994#M93286" target="_blank"&gt;https://community.qlik.com/t5/QlikView-Scripting/rank-in-script/m-p/1517994#M93286&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Sort you table based on your count and then add:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;IF(ROWNO()=1,1,PEEK('&lt;SPAN&gt;targetcounter&lt;/SPAN&gt;',-1)+1) AS &lt;SPAN&gt;targetcounter&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;It peeks at the previous rows and adds 1 to that number. When sorted at the correct count field you'll get a Rank.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you want to start a new count for every ID use this:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;IF(PEEK('&lt;SPAN&gt;reporting_centers&lt;/SPAN&gt;',-1)&amp;lt;&amp;gt;ID,1,PEEK('&lt;SPAN&gt;targetcounter&lt;/SPAN&gt;',-1)+1) AS &lt;SPAN&gt;targetcounter&lt;/SPAN&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Dec 2018 12:18:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-count-lines-for-each-group-separately/m-p/1518631#M598399</guid>
      <dc:creator>avkeep01</dc:creator>
      <dc:date>2018-12-10T12:18:43Z</dc:date>
    </item>
    <item>
      <title>Re: How count lines for each group separately</title>
      <link>https://community.qlik.com/t5/QlikView/How-count-lines-for-each-group-separately/m-p/1518632#M598400</link>
      <description>&lt;P&gt;Here are the two options&lt;/P&gt;&lt;PRE&gt;Table:
LOAD *,
	 If(reporting_centers = Previous(reporting_centers), RangeSum(Peek('targetcounter'), 1), 1) as targetcounter,
	 AutoNumber(RowNo(), reporting_centers) as targetcounter2;
LOAD * INLINE [
    reporting_centers, id
    1, some_Uniqvalue
    1, some_Uniqvalue
    1, some_Uniqvalue
    2, some_Uniqvalue
    2, some_Uniqvalue
    3, some_Uniqvalue
    3, some_Uniqvalue
    3, some_Uniqvalue
];&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Dec 2018 12:17:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-count-lines-for-each-group-separately/m-p/1518632#M598400</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-12-10T12:17:40Z</dc:date>
    </item>
    <item>
      <title>Re: How count lines for each group separately</title>
      <link>https://community.qlik.com/t5/QlikView/How-count-lines-for-each-group-separately/m-p/1518663#M598401</link>
      <description>&lt;P&gt;The second optin helps me! Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 10 Dec 2018 12:57:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-count-lines-for-each-group-separately/m-p/1518663#M598401</guid>
      <dc:creator>Ilya_Bobrov</dc:creator>
      <dc:date>2018-12-10T12:57:11Z</dc:date>
    </item>
  </channel>
</rss>

