<?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: Counting or concatenating until a value changes in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Counting-or-concatenating-until-a-value-changes/m-p/1524507#M37658</link>
    <description>&lt;P&gt;Might be possible, but will require a complex expression... you don't have access to the script?&lt;/P&gt;</description>
    <pubDate>Thu, 27 Dec 2018 17:08:07 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2018-12-27T17:08:07Z</dc:date>
    <item>
      <title>Counting or concatenating until a value changes</title>
      <link>https://community.qlik.com/t5/App-Development/Counting-or-concatenating-until-a-value-changes/m-p/1524438#M37645</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I a production environment I'm trying to analyse whether a batch of products have been produced in a logical order.&lt;/P&gt;&lt;P&gt;It occurs that I have something like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Load * Inline[&lt;/P&gt;&lt;P&gt;Batch,Time,Product&lt;/P&gt;&lt;P&gt;1,11:01,A&lt;/P&gt;&lt;P&gt;1,11:02,A&lt;/P&gt;&lt;P&gt;1,11:03,A&lt;/P&gt;&lt;P&gt;1,11:04,B&lt;/P&gt;&lt;P&gt;1,11:05,B&lt;/P&gt;&lt;P&gt;1,11:06,A&lt;/P&gt;&lt;P&gt;1,11:06,B&lt;/P&gt;&lt;P&gt;2,12:30,A&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;Counting/Concat Distinct is obvious, but this 'ignores' the sequentiality of the data.&lt;/P&gt;&lt;P&gt;In a diagram I want to make a check for these non-conformities. The result should either be&lt;/P&gt;&lt;P&gt;Batch&amp;nbsp;&amp;nbsp; Number of sequencial products&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&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;Or&lt;/P&gt;&lt;P&gt;Batch&amp;nbsp; Sequence of products&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A,B,A,B&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/t5/QlikView-Scripting/count-until-value-changes-in-diagram/td-p/1025563" target="_blank"&gt;I've found this other topic &lt;/A&gt;but here it's put into the script. I'm looking for something similar.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyone an idea?&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 06:58:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Counting-or-concatenating-until-a-value-changes/m-p/1524438#M37645</guid>
      <dc:creator>michiel_</dc:creator>
      <dc:date>2024-11-16T06:58:20Z</dc:date>
    </item>
    <item>
      <title>Re: Counting or concatenating until a value changes</title>
      <link>https://community.qlik.com/t5/App-Development/Counting-or-concatenating-until-a-value-changes/m-p/1524447#M37647</link>
      <description>&lt;P&gt;Start by creating a new field in the script like this&lt;/P&gt;&lt;PRE&gt;Table:
LOAD * INLINE [
    Batch, Time, Product
    1, 11:01, A
    1, 11:02, A
    1, 11:03, A
    1, 11:04, B
    1, 11:05, B
    1, 11:06, A
    1, 11:06, B
    2, 12:30, A
];

FinalTable:
LOAD *,
	 If(Batch = Previous(Batch), If(Product = Previous(Product), Peek('Num'), RangeSum(Peek('Num'), 1)), 1) as Num
Resident Table
Order By Batch, Time;

DROP Table Table;&lt;/PRE&gt;&lt;P&gt;and then you can create your count and concat like this&lt;/P&gt;&lt;P&gt;Count&lt;/P&gt;&lt;PRE&gt;=Count(DISTINCT Num)&lt;/PRE&gt;&lt;P&gt;Concat&lt;/P&gt;&lt;PRE&gt;=Concat(DISTINCT Product, ',', Num)&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Dec 2018 15:18:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Counting-or-concatenating-until-a-value-changes/m-p/1524447#M37647</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-12-27T15:18:46Z</dc:date>
    </item>
    <item>
      <title>Re: Counting or concatenating until a value changes</title>
      <link>https://community.qlik.com/t5/App-Development/Counting-or-concatenating-until-a-value-changes/m-p/1524502#M37657</link>
      <description>&lt;P&gt;Thanks, this looks good, but no possibility to do this on the worksheet only then?&lt;/P&gt;</description>
      <pubDate>Thu, 27 Dec 2018 16:54:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Counting-or-concatenating-until-a-value-changes/m-p/1524502#M37657</guid>
      <dc:creator>michiel_</dc:creator>
      <dc:date>2018-12-27T16:54:06Z</dc:date>
    </item>
    <item>
      <title>Re: Counting or concatenating until a value changes</title>
      <link>https://community.qlik.com/t5/App-Development/Counting-or-concatenating-until-a-value-changes/m-p/1524507#M37658</link>
      <description>&lt;P&gt;Might be possible, but will require a complex expression... you don't have access to the script?&lt;/P&gt;</description>
      <pubDate>Thu, 27 Dec 2018 17:08:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Counting-or-concatenating-until-a-value-changes/m-p/1524507#M37658</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-12-27T17:08:07Z</dc:date>
    </item>
    <item>
      <title>Re: Counting or concatenating until a value changes</title>
      <link>https://community.qlik.com/t5/App-Development/Counting-or-concatenating-until-a-value-changes/m-p/1525451#M37749</link>
      <description>&lt;P&gt;I do have access, but was wondering if it would be possible on the worksheet. Your example before will work, I'll start working on the script:)&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jan 2019 13:57:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Counting-or-concatenating-until-a-value-changes/m-p/1525451#M37749</guid>
      <dc:creator>michiel_</dc:creator>
      <dc:date>2019-01-02T13:57:58Z</dc:date>
    </item>
  </channel>
</rss>

