<?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: Count of Unique IDs based on two requirements (loop? if/then?) in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Count-of-Unique-IDs-based-on-two-requirements-loop-if-then/m-p/1161558#M915462</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Awesome &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 28 May 2016 23:18:13 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2016-05-28T23:18:13Z</dc:date>
    <item>
      <title>Count of Unique IDs based on two requirements (loop? if/then?)</title>
      <link>https://community.qlik.com/t5/QlikView/Count-of-Unique-IDs-based-on-two-requirements-loop-if-then/m-p/1161552#M915454</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; &lt;SPAN lang="EN-US" style="font-size: 12.0pt; font-family: 'Times New Roman',serif;"&gt;Hello QlikView Users,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-top: auto; margin-bottom: auto;"&gt;&lt;SPAN lang="EN-US" style="font-size: 12.0pt; font-family: 'Times New Roman',serif;"&gt;I am new to Qlikview (and this forum) and would kindly like to ask for your advice on the following question:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-top: auto; margin-bottom: auto;"&gt;&lt;SPAN lang="EN-US" style="font-size: 12.0pt; font-family: 'Times New Roman',serif;"&gt;My data has the following structure: &lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;SPAN lang="EN-US" style="font-size: 12.0pt; font-family: 'Times New Roman',serif;"&gt;DocumentID&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 12.0pt; font-family: 'Times New Roman',serif;"&gt; (unique) | &lt;SPAN style="text-decoration: underline;"&gt;Date start&lt;/SPAN&gt; | &lt;SPAN style="text-decoration: underline;"&gt;Date end&lt;/SPAN&gt; | …&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P style="margin-top: auto; margin-bottom: auto;"&gt;&lt;SPAN lang="EN-US" style="font-size: 12.0pt; font-family: 'Times New Roman',serif;"&gt;My Task is to display the amount of "&lt;EM&gt;unfinished&lt;/EM&gt;" &lt;SPAN style="text-decoration: underline;"&gt;DocumentID&lt;/SPAN&gt;s by &lt;SPAN style="text-decoration: underline;"&gt;2016-calender week&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: auto; margin-bottom: auto;"&gt;&lt;SPAN lang="EN-US" style="font-size: 12.0pt; font-family: 'Times New Roman',serif;"&gt;A &lt;SPAN style="text-decoration: underline;"&gt;DocumentID&lt;/SPAN&gt;s is to be counted as "&lt;EM&gt;unfinished&lt;/EM&gt;", if they were already started (&lt;SPAN style="text-decoration: underline;"&gt;Date start&lt;/SPAN&gt; is filled), but do not have an &lt;SPAN style="text-decoration: underline;"&gt;Date end&lt;/SPAN&gt; (is blank) yet.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-top: auto; margin-bottom: auto;"&gt;&lt;SPAN lang="EN-US" style="font-size: 12.0pt; font-family: 'Times New Roman',serif;"&gt;I can easily get this by asking each start of the week how many &lt;SPAN style="text-decoration: underline;"&gt;DocumentID&lt;/SPAN&gt;s have a &lt;SPAN style="text-decoration: underline;"&gt;Date start&lt;/SPAN&gt;, but not a &lt;SPAN style="text-decoration: underline;"&gt;Date end.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: auto; margin-bottom: auto;"&gt;&lt;SPAN lang="EN-US" style="font-size: 12.0pt; font-family: 'Times New Roman',serif;"&gt;However, in doing so I cannot get the amount of unfinished &lt;SPAN style="text-decoration: underline;"&gt;DocumentID&lt;/SPAN&gt;s for the previous or older calender weeks (as they already have a &lt;SPAN style="text-decoration: underline;"&gt;Date end&lt;/SPAN&gt;).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-top: auto; margin-bottom: auto;"&gt;&lt;SPAN lang="EN-US" style="font-size: 12.0pt; font-family: 'Times New Roman',serif;"&gt;Thus, I would like to have a bar chart that shows me the COUNT of "&lt;EM&gt;unfinished&lt;/EM&gt;" &lt;SPAN style="text-decoration: underline;"&gt;DocumentID&lt;/SPAN&gt; by &lt;SPAN style="text-decoration: underline;"&gt;2016-calender week&lt;/SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: auto; margin-bottom: auto;"&gt;&lt;SPAN lang="EN-US" style="font-size: 12.0pt; font-family: 'Times New Roman',serif;"&gt;A &lt;SPAN style="text-decoration: underline;"&gt;DocumentID&lt;/SPAN&gt; should be counted for each &lt;SPAN style="text-decoration: underline;"&gt;2016-calender week&lt;/SPAN&gt; when it was startet, but not finished.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: auto; margin-bottom: auto;"&gt;&lt;SPAN lang="EN-US" style="font-size: 12.0pt; font-family: 'Times New Roman',serif;"&gt;It should therefore be counted for each &lt;SPAN style="text-decoration: underline;"&gt;2016-calender week&lt;/SPAN&gt; that &lt;/SPAN&gt;&lt;/P&gt;&lt;OL start="1"&gt;&lt;LI&gt;&lt;SPAN lang="EN-US" style="font-size: 12.0pt; font-family: 'Times New Roman',serif;"&gt;Calendarweek(Date start) is &amp;lt; today() and &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN lang="EN-US" style="font-size: 12.0pt; font-family: 'Times New Roman',serif;"&gt;Calenderweek(Date end) is blank OR &amp;gt; today()&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN lang="EN-US" style="font-size: 12.0pt; font-family: 'Times New Roman',serif;"&gt;How can I realize this in Qlikview?&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-top: auto; margin-bottom: auto;"&gt;&lt;SPAN lang="EN-US" style="font-size: 12.0pt; font-family: 'Times New Roman',serif;"&gt;I assume I need a kind of loop that goes through all of my &lt;SPAN style="text-decoration: underline;"&gt;DocumentID&lt;/SPAN&gt;s for each &lt;SPAN style="text-decoration: underline;"&gt;2016-calendar week&lt;/SPAN&gt; and checks if the two requirements I have were met. If yes, it should be counted, if not it should be skipped and the loop should start the next &lt;SPAN style="text-decoration: underline;"&gt;2016-calendar-week&lt;/SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-top: auto; margin-bottom: auto;"&gt;&lt;SPAN lang="EN-US" style="font-size: 12.0pt; font-family: 'Times New Roman',serif;"&gt;Thank you very much in advance for your help.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-top: auto; margin-bottom: auto;"&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Times New Roman',serif;"&gt;Kind regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Times New Roman',serif;"&gt;Michael&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-of-Unique-IDs-based-on-two-requirements-loop-if-then/m-p/1161552#M915454</guid>
      <dc:creator />
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Count of Unique IDs based on two requirements (loop? if/then?)</title>
      <link>https://community.qlik.com/t5/QlikView/Count-of-Unique-IDs-based-on-two-requirements-loop-if-then/m-p/1161553#M915456</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Michael -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If a document's end date is during the mid week, would that be considered as open or closed for that week? I have two solution proposed (And two more coming using IntervalMatch option)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Community_218635.qvw&lt;/STRONG&gt; is including a document ending midweek into the open week. Script is as follows&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD Document,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Start, &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If(Len(Trim(End)) &amp;gt; 0, End) as End,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Date(Start + IterNo() - 1) as OpenDate,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Dual(Week(Date(Start + IterNo() - 1))&amp;amp;'-'&amp;amp;Year(Date(Start + IterNo() - 1)), WeekStart(Date(Start + IterNo() - 1))) as OpenWeek&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;While Start + IterNo() - 1 &amp;lt;= &lt;SPAN style="color: #ff0000;"&gt;If(Len(Trim(End)) &amp;gt; 0, End, Today())&lt;/SPAN&gt;;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD * Inline [&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Document, Start, End&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;A, 01/02/2016, 03/03/2016&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;B, 03/05/2016,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;C, 05/23/2016,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;D, 02/12/2016, 03/23/2016&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;];&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/126099_Capture.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;STRONG&gt;Community_218635_v1.qvw&lt;/STRONG&gt; is not including a document ending midweek into the open week. Script is as follows&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD Document,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Start, &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If(Len(Trim(End)) &amp;gt; 0, End) as End,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Date(Start + IterNo() - 1) as OpenDate,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Dual(Week(Date(Start + IterNo() - 1))&amp;amp;'-'&amp;amp;Year(Date(Start + IterNo() - 1)), WeekStart(Date(Start + IterNo() - 1))) as OpenWeek&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;While Start + IterNo() - 1 &amp;lt; &lt;SPAN style="color: #ff0000;"&gt;If(Len(Trim(End)) &amp;gt; 0, WeekStart(End), Today() + 1)&lt;/SPAN&gt;;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD * Inline [&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Document, Start, End&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;A, 01/02/2016, 03/03/2016&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;B, 03/05/2016,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;C, 05/23/2016,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;D, 02/12/2016, 03/23/2016&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;];&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/126100_Capture.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the second script, you will see that A is not included in Week 10 because it is ending during the week 10.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Will be attaching IntervalMatch function soon.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Sunny&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 May 2016 12:06:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-of-Unique-IDs-based-on-two-requirements-loop-if-then/m-p/1161553#M915456</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-05-28T12:06:11Z</dc:date>
    </item>
    <item>
      <title>Re: Count of Unique IDs based on two requirements (loop? if/then?)</title>
      <link>https://community.qlik.com/t5/QlikView/Count-of-Unique-IDs-based-on-two-requirements-loop-if-then/m-p/1161554#M915458</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;With IntervalMatch I was only able to replicate the first case. I am sure there is a way to do the second one also, but I am going to wait for your response to see if we even need that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD * Inline [&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Document, Start, End&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;A, 01/02/2016, 03/03/2016&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;B, 03/05/2016,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;C, 05/23/2016,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;D, 02/12/2016, 03/23/2016&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;];&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;MinMax:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD Min(Start) as Min,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Num(Today()) as Max&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident Table;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LET vMin = Peek('Min');&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LET vMax = Peek('Max');&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;TRACE $(vMin) &amp;amp; $(vMax);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DROP Table MinMax;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Calendar:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD *,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Dual(Week(Date)&amp;amp;'-'&amp;amp;Year(Date), WeekStart(Date)) as OpenWeek;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD Date($(vMin) + IterNo() - 1) as Date&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;AutoGenerate 1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;While $(vMin) + IterNo() - 1 &amp;lt;= $(vMax);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;IntervalMatch:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;IntervalMatch(Date)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD Start,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; End as End&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident Table;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;IMG __jive_id="126107" alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/126107_Capture.PNG" style="height: auto;" /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data structure with IntervalMatch:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/126108_Capture.PNG" style="height: 386px; width: 620px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 May 2016 12:23:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-of-Unique-IDs-based-on-two-requirements-loop-if-then/m-p/1161554#M915458</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-05-28T12:23:33Z</dc:date>
    </item>
    <item>
      <title>Re: Count of Unique IDs based on two requirements (loop? if/then?)</title>
      <link>https://community.qlik.com/t5/QlikView/Count-of-Unique-IDs-based-on-two-requirements-loop-if-then/m-p/1161555#M915459</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Sunny T,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;first of all, thank you very much for your help. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mid-Week Closure counts for the week where it was closed, not the following week.&lt;/P&gt;&lt;P&gt;(I always do my reporting on mondays - so whatever is open then is not counted).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For Open documents the current weeknumber (of today()) should be used as end date, therefore the open documents will always be added to the current week.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I transferred the code for the first solution to my Qlikview, slightly modified the second load to relfect my data, managed to load my Data from the Excel and created a Pivot Table to assess the count of documents by calenderweek.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD Document, Start,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If(Len(Trim(End)) &amp;gt; 0, End) as End,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Date(Start + IterNo() - 1) as OpenDate,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Dual(Week(Date(Start + IterNo() - 1))&amp;amp;'-'&amp;amp;Year(Date(Start + IterNo() - 1)), WeekStart(Date(Start + IterNo() - 1))) as OpenWeek&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; While Start + IterNo() - 1 &amp;lt;= If(Len(Trim(End)) &amp;gt; 0, End, Today());&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD Document, Start, End FROM [..\sample.xlsx] (ooxml, embedded labels, table is Tabelle1);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, utilizing my data, I do not come up with the numbers I recorded during the last weeks (by simply asking each start of the week how many documents were not finished).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The logic itself seems to work, because if I use a picklist filter to search for a Document ID, it states me all the weeks, when it was open. However somehow the counting is wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Analyzing it in Excel, I come up with values roughly as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CW18: 46&lt;/P&gt;&lt;P&gt;CW19: 49&lt;/P&gt;&lt;P&gt;CW20: 53&lt;/P&gt;&lt;P&gt;CW21: 56&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your solution gives the following values:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Openweek vs count(Document)&lt;/P&gt;&lt;P&gt;CW18: 352&lt;/P&gt;&lt;P&gt;CW19: 391&lt;/P&gt;&lt;P&gt;CW20: 397&lt;/P&gt;&lt;P&gt;CW21: 296&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I assume I made an error with counting. If an ID is open for 2 weeks it seems to add 7 to each of the open weeks, instead of 1 for each week (it counts the days, not the weeks).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;I assume I have to add some DISCTINT, but i dont know where &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="count2.png" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/126115_count2.png" style="height: 327px; width: 620px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 May 2016 15:56:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-of-Unique-IDs-based-on-two-requirements-loop-if-then/m-p/1161555#M915459</guid>
      <dc:creator />
      <dc:date>2016-05-28T15:56:54Z</dc:date>
    </item>
    <item>
      <title>Re: Count of Unique IDs based on two requirements (loop? if/then?)</title>
      <link>https://community.qlik.com/t5/QlikView/Count-of-Unique-IDs-based-on-two-requirements-loop-if-then/m-p/1161556#M915460</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Would you be able to share your application or the data behind the application? I might not know what isn't working without taking a look at it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Sunny&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 May 2016 18:13:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-of-Unique-IDs-based-on-two-requirements-loop-if-then/m-p/1161556#M915460</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-05-28T18:13:05Z</dc:date>
    </item>
    <item>
      <title>Re: Count of Unique IDs based on two requirements (loop? if/then?)</title>
      <link>https://community.qlik.com/t5/QlikView/Count-of-Unique-IDs-based-on-two-requirements-loop-if-then/m-p/1161557#M915461</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually, I solved it by playing around a bit &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the Graph I needed to use:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;count(DISTINCT Document)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now it perfectly works.&lt;/P&gt;&lt;P&gt;Thank you very much!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Topic can be closed.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 May 2016 20:29:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-of-Unique-IDs-based-on-two-requirements-loop-if-then/m-p/1161557#M915461</guid>
      <dc:creator />
      <dc:date>2016-05-28T20:29:09Z</dc:date>
    </item>
    <item>
      <title>Re: Count of Unique IDs based on two requirements (loop? if/then?)</title>
      <link>https://community.qlik.com/t5/QlikView/Count-of-Unique-IDs-based-on-two-requirements-loop-if-then/m-p/1161558#M915462</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Awesome &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 May 2016 23:18:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-of-Unique-IDs-based-on-two-requirements-loop-if-then/m-p/1161558#M915462</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-05-28T23:18:13Z</dc:date>
    </item>
  </channel>
</rss>

